Here is my rule:

RewriteRule ^[^/]+/([^/]*)/([^/]*)\\.php$ /review_single.php?item_id=$1&id=$2 [L]

Original URL:

Rewritten URL:

The word chilis is a category that gets pulled from the database.

That works great but there’s a part of the website that will only work if I put a forward slash at the beginning changing it to this:

RewriteRule ^/[^/]+/([^/]*)/([^/]*)\\.php$ /review_single.php?item_id=$1&id=$2 [L]

BUT when I do that, it breaks another part of the site.

How do I rewrite that so that one area of the site will work with the ‘/’ and the other part will work without it?

Thanks in advance,


You could make the / at the start optional by using


but it sounds like a weird problem. Why doesn’t a part of the website work without that leading slash?