Jump to content

How to redirect sef url


SametALMDR

Recommended Posts

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 😞

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by SametALMDR
Link to comment
Share on other sites

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!

Link to comment
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.   Paste as plain text instead

  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

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated