Jump to content

.htaccess rewrite rule not working


l3rodey

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 :( 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • 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.