I am really puzzeld, I want to use htaccess Rewrite to rewrite an url with parameter to one without. This is my .htaccess file:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^sitemap.xml$ sitemap.php [NC] # Handle requests for "sitemap"
RewriteRule ^category/([A-Za-z0-9-]+)/$ displaycategory.php?category_name=$1 [NC] # Handle requests for "categories"
RewriteRule ^items/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ item.php?category_name=$1&id=$2 [NC] # Handle requests for "single item"
Rule 1 and rule 3 are working fine, but the second url redirects to index.php
If I call this url:
it redirects to
Your .htaccess rewrite rule is correct, and I assume its not this causing the problem. If you have a directory called test or another file very close to test Apache Multiviews could be the problem. Have you access to server logs? I bet there is something in the server config preventing the rule from working correctly.