Can’t Create 301 redirect

#533999
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    Rank Math doesn’t handle domain/server-level redirection. The best way to redirect your site form www to non-www is by adding rules in your .htaccess.

    Here’s a guide you can follow to achieve this redirection:
    https://rankmath.com/kb/how-to-redirect-www-urls-to-non-www/

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

    ​​​​​​​

    Donald
    Rank Math free

    Hi Thanks for get back to me – I’ve followed the instructions in the link you sent editing the .htaccess but doesn’t work – I tried the 2 x different codes as per the guide but when I run the ht tester it says – https://htaccess.madewithlove.com?share=a9dcaf25-e6fd-4f4b-8588-0e70019c837a – the condition is not met?

    Am I right, should I change the code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.website.com [NC]
    RewriteRule ^(.*)$ https://website.com/$1 [L,R=301]

    to

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.website.com [NC]
    RewriteRule ^(.*)$ https://conferencecall.lascomsolutions.co.uk$1 [L,R=301]

    Also were I add the code – # END WordPress

    there is already this added below this
    # END WordPress
    # SGO Unset Vary
    Header unset Vary
    # SGO Unset Vary END

    so should I be adding the code in-between # END WordPress and # SGO Unset Vary

    Hello,

    Please try inserting the following rules instead:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.conferencecall.lascomsolutions.co.uk [NC]
    RewriteRule ^(.*)$ https://conferencecall.lascomsolutions.co.uk$1 [L,R=301]

    And make sure you’ve added the rules above the below rules:

    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Donald
    Rank Math free

    Hi Sakib

    Sorry still struggling with this? I’ve tested the cade you sent so know it works but I tried placing it were you said but no go! below is my full .htaccess file – can you highlight/show the exact position any spaces etc please

    ——————————————————————————————-
    # BEGIN LSCACHE
    ## LITESPEED WP CACHE PLUGIN – Do not edit the contents of this block! ##
    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* – [E=Cache-Control:no-autoflush]
    RewriteRule \.litespeed_conf\.dat – [F,L]

    ### marker CACHE RESOURCE start ###
    RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php – [E=cache-control:max-age=3600]
    ### marker CACHE RESOURCE end ###

    ### marker FAVICON start ###
    RewriteRule favicon\.ico$ – [E=cache-control:max-age=86400]
    ### marker FAVICON end ###

    ### marker DROPQS start ###
    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
    ### marker DROPQS end ###

    </IfModule>
    ## LITESPEED WP CACHE PLUGIN – Do not edit the contents of this block! ##
    # END LSCACHE
    # BEGIN NON_LSCACHE
    ## LITESPEED WP CACHE PLUGIN – Do not edit the contents of this block! ##
    ## LITESPEED WP CACHE PLUGIN – Do not edit the contents of this block! ##
    # END NON_LSCACHE
    # HTTPS forced by SG-Optimizer
    <IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>
    # END HTTPS

    # BEGIN WordPress
    # The directives (lines) between “BEGIN WordPress” and “END WordPress” are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # SGO Unset Vary
    Header unset Vary
    # SGO Unset Vary END

    Hello,

    You may try placing the rule after the below rules:

    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    This is how it should look like:

    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    RewriteCond %{HTTP_HOST} ^www.conferencecall.lascomsolutions.co.uk [NC]
    RewriteRule ^(.*)$ https://conferencecall.lascomsolutions.co.uk$1 [L,R=301]

    Please do take a backup before editing your .htaccess file.

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘Can’t Create 301 redirect’ is closed to new replies.