SametALMDR Posted May 26, 2021 Share Posted May 26, 2021 Hello everyone, I'm trying to redirect domain.com/cart.php?a=add&domain=register url to domain.com/domainregister using .htaccess in the root folder of whmcs. I tried many things but does not work. Any of you know how to do this operation using .htaccess guys ? Please help mee 😞 0 Quote Link to comment Share on other sites More sharing options...
jayjay Posted May 26, 2021 Share Posted May 26, 2021 I'm trying something similar - redirecting one product to another (e.g. pid=10 to pid=11, since pid=10 is out of stock). Cant get it work using .htaccess 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted May 26, 2021 Share Posted May 26, 2021 RewriteCond %{QUERY_STRING} domain=register RewriteRule ^cart\.php$ https://example.com/domains/register? [R=301,L] Having the question mark ("?") at the end of the redirect to URL removes the query string and so if you want to keep it then remove that question mark. 0 Quote Link to comment Share on other sites More sharing options...
jayjay Posted May 27, 2021 Share Posted May 27, 2021 9 hours ago, steven99 said: RewriteCond %{QUERY_STRING} domain=register RewriteRule ^cart\.php$ https://example.com/domains/register? [R=301,L] Having the question mark ("?") at the end of the redirect to URL removes the query string and so if you want to keep it then remove that question mark. Thanks @steven99, I'm trying to use this approach to redirect from one product to another and this is what I have so far: ### END - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS ### <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{QUERY_STRING} pid=11 RewriteRule ^pid=11$ https://www.domain.com/whmcs/cart.php?a=add&pid=17 [R=301,L] </IfModule> However, it doesn't seem to work. The old product (pid = 11) is marked out of stock and hidden on the order form, so it keeps redirecting me to the group page instead of pid = 17 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted May 28, 2021 Share Posted May 28, 2021 The rule should be: RewriteRule ^cart.php$ https://www.domain.com/whmcs/cart.php?a=add&pid=17 [R=301,L] 0 Quote Link to comment Share on other sites More sharing options...
jayjay Posted May 28, 2021 Share Posted May 28, 2021 6 hours ago, steven99 said: The rule should be: RewriteRule ^cart.php$ https://www.domain.com/whmcs/cart.php?a=add&pid=17 [R=301,L] Thanks steven. I tried this and it seems to redirect every product to that link - I only need one (pid=11) to redirect. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted June 1, 2021 Share Posted June 1, 2021 That is where the RewriteCond %{QUERY_STRING} pid=11 part comes in. You have that right before the rewriterule and it will trigger the rule only if the pid=11 is in the query string. 1 Quote Link to comment Share on other sites More sharing options...
SametALMDR Posted June 1, 2021 Author Share Posted June 1, 2021 (edited) Thanks @steven99. Also, there is a problem with that link domain.com/index.php?rp=/login . I want to just connect this link to domain.com/signin. I tried many things and options from the admin panel. RewriteRule ^signin$ ./index.php?rp=/login [NC] Is the above rule is correct? @steven99 Edited June 1, 2021 by SametALMDR 0 Quote Link to comment Share on other sites More sharing options...
jayjay Posted June 2, 2021 Share Posted June 2, 2021 On 1/06/2021 at 5:23 AM, steven99 said: That is where the RewriteCond %{QUERY_STRING} pid=11 part comes in. You have that right before the rewriterule and it will trigger the rule only if the pid=11 is in the query string. Thanks, that did the trick! 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.