Jump to content
Sign in to follow this  
l3rodey

.htaccess rewrite rule not working

Recommended Posts

Hi Guys, I have a URL that looks like this:

www.example.com/category.php?cat_slug=whiskey/single-malt

this shows up everything works fine... I have a htaccess file that is this:

RewriteRule ^([0-9a-z-/-A-Z_-]+)?$ category.php?cat_slug=$1 [NC,L]

This doesn't work but yet the product does... 

RewriteRule ^([0-9a-z-/-A-Z_-]+)/([0-9a-zA-Z_-]+)?$ product.php?cat_slug=$1&prod_slug=$2 [NC,L]

Which looks like this www.example.com/whiskey/single-malt/haig-club-clubman-70cl once rewritten. 

 

The top example doesn't work though which should rewrite to 

www.example.com/whiskey/single-malt

 

Why would the second one work but not the first one?

 

Please don't get too technical here, I found the code online 2 years ago and have used it ever since. I don't actually understand what it does or why it does what it does, it just works... I know if I put it into a folder like shop/ so RewriteRule ^shop/([0-9a-z-/-A-Z_-]+)?$ category.php?cat_slug=$1 [NC,L] it will work, but for this website I don't want that... 

 

Please help me :( 

Share this post


Link to post
Share on other sites

Do you have both of those RewriteRules running at the same time? Which one is listed first?

 

And "doesn't work" is meaningless. Means nothing. Unhelpful. How does it not work?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.