1
votes

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

2
The rule looks fine. Check your server log (/var/log/apache2/error.log on Linux) - there will be an entry since it's a 500 error. Probably some configuration thing.Ansari
Oh wait, you have a-Z and A-z - which is weird. put a-zA-ZAnsari
It would also help if you posted the URL that is being rewritten, not just what the result should beerm410
Hmmm. I wonder what does defined by a module not included in the server configuration mean?Salman A
The rewritelog says mod_rewrite is not enabled/installed. Rule seems to look fine, although you might need Option -Multiviews to get it working properly.Gerben

2 Answers

2
votes

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.

1
votes

You need to install the mod rewrite module.