user652792
user652792

Reputation:

500 Internal Server Error while trying to Rewrite URL in .htaccess

I need your help in creating dynamic URL for SEO gains.. I tried to implement the following .htaccess on my present URL. But I got an 500 Internal Server Error

please where could the problem be? Thanks

Link

http://127.0.0.1/index.php?id=1

.htaccess

RewriteEngine on
RewriteRule ^index/([a-zA-Z0-9]+)/$ index.php?id=$1

Apache Error Log

Invalid Command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Upvotes: 1

Views: 2280

Answers (2)

rekire
rekire

Reputation: 47945

You need to install the mod rewrite module.

Upvotes: 0

Ansari
Ansari

Reputation: 8218

Replace your rule with

RewriteRule ^index/([a-zA-Z0-9]+)/$ index.php?id=$1 [L]

a-Z doesn't work the way one might think it does, and A-z is just weird. That's what's throwing the error.

Also, adding the [L] flag prevents further rewriting.

Upvotes: 2

Related Questions