l3rodey Posted February 8, 2017 Share Posted February 8, 2017 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 Quote Link to comment https://forums.phpfreaks.com/topic/303130-htaccess-rewrite-rule-not-working/ Share on other sites More sharing options...
requinix Posted February 8, 2017 Share Posted February 8, 2017 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? Quote Link to comment https://forums.phpfreaks.com/topic/303130-htaccess-rewrite-rule-not-working/#findComment-1542455 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.