Remitur Posted June 2, 2019 Share Posted June 2, 2019 For few products groups I've prepared a presentation page, and would like to redirect corresponding menu items of the "store" menu, to this page. I.e., I would like that "SSL certificates" menu item, which point to /cart.php?gid=7 , would be inted redirected to /ssl-certificates.php Tried with following statement in .htaccess: Redirect 301 /cart.php?gid=7 /ssl-certificates.php ... but it doesn't work... 😞 Any idea? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted June 3, 2019 Share Posted June 3, 2019 Could you try placing it on top of your .htaccess? 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 3, 2019 Share Posted June 3, 2019 16 hours ago, Remitur said: Any idea? technically, i'm still on holiday (just started) but had to login to answer a few urgent PMs, so while i'm here... 🏖️ 16 hours ago, Remitur said: For few products groups I've prepared a presentation page, and would like to redirect corresponding menu items of the "store" menu, to this page. i'd have said just to use a hook to change the links for these specific groups - the hook I posted in the thread below will do that, you'll just have to change the group names you want to redirect, and the file/url to redirect them to... and now i'll disappear again into the ether... 🍦 1 Quote Link to comment Share on other sites More sharing options...
Remitur Posted June 3, 2019 Author Share Posted June 3, 2019 6 hours ago, Kian said: Could you try placing it on top of your .htaccess? I tried... nothing change. I guess it may be related to the php parameter ?gid=7 ... Would need to deeper test it to understand how it can works. 4 hours ago, brian! said: i'd have said just to use a hook to change the links for these specific groups - the hook I posted in the thread below will do that, you'll just have to change the group names you want to redirect, and the file/url to redirect them to... Great!!! Your hook works fine!!!! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted June 3, 2019 Share Posted June 3, 2019 (edited) Ouch... I forgot that Redirect 301 doesn't work with query string. You can redirect old.php to new.php but old.php?bla=true will never match anything. For this kind of stuff you need to use RewriteRule. The rule below should work (my htaccess skills are poor 😑). RewriteEngine On RewriteCond %{REQUEST_URI} ^/cart.php$ RewriteCond %{QUERY_STRING} ^gid=7$ RewriteRule ^ ssl-certificates.php [R=301,L] Edited June 3, 2019 by Kian 0 Quote Link to comment 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.