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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

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.