Reputation: 1405
I'm modifying the Apache .htaccess
file for rewrite products' URL, so I can go from this
domain.com/section/products/product.php?url=some-product-name
to this
domain.com/section/products/some-product-name
Here's the mod_rewrite
code that I'm using:
Options -Indexes
Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^section/products/(.*)$ /section/products/product.php?url=$1 [QSA,L]
It just returns a 500 server error.
What could be the issue?
Upvotes: 2
Views: 114
Reputation: 785156
It is because your rewrite rules are infinitely looping. Which is due to the fact section/products/(.*)
pattern matches original and rewritten URI.
You can use this to fix it:
Options +FollowSymlinks -Indexes -MultiViews
Options -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^(section/products)/([\w-]+)$ $1/product.php?url=$2 [QSA,L,NC]
Upvotes: 1