The www and non-www versions of your URL are not redirected to the same site.

#60972
  • Resolved Constant1
    Rank Math free

    Hello,

    I have been running the “SEO Analysis” tool of RankMath in WP and I get the following error:
    The www and non-www versions of your URL are not redirected to the same site.

    I don’t really understand it since http://www.mysitecom does redirect to mysite.com. I have read other user’s issues but they all seem to be different from me, often the redirect does not work. In this case, unless I am blind, it does seem to work so I am at loss as to why I’m getting this message.

    (Actual link in sensitive data area)

    Thank you so much!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Alberto
    Rank Math business

    Hello,

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

    I have checked it but meanwhile it shows your website it doesn’t fully redirect the website.

    The tool is recommending you that when the user types, for example, https://www.website.com, the URL is rewritten to https://website.com.

    And in your case, I am still seeing the www. after loading the site with that URL.

    Luckily it is easy to “fix”, you just need to add a few lines in your .htaccess file.

    You can add these lines at the beginning of your .htaccess file (editing it with your domain):

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

    After that, the issue should be solved.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello, thanks for the reply, I’m sorry but I don’t understand how to fix that.

    I have added

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

    to the my .htaccess, clear my browers’ cache and tried: same error.

    I then noted I am using ReallySimpleSSL so looked for help on their site, and their recommended `#redirect all www requests to non-www.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
    </IfModule>`
    Which did not work either, either when moved up the .htaccess file

    Right my .htaccess starts (nothing else above) with:

    # BEGIN www to non www
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.domain.tld [NC]
    RewriteRule ^(.*)$ http://domain.tld/$1 [R=301,L]
    <IfModule>
    # END fix www to non www

    and still no joy. I really don’t understand how to fix and who can help me. 🙁

    Todd
    Rank Math free

    Hello,

    You will have to contact your web host about that.

    It should be working and only your web host can provide insight on why it isn’t working.

    Since this is not a Rank Math issue or feature, our assistance in this regard is going to be limited.

    Do let us know if you have any queries regarding Rank Math or any of the features we offer.

    Problem solved.

    Although the issue was indeed with .htaccess, it was mistaken of me to update .htaccess file. My site is hosted with Amazon Lightsail, which uses bitnami, and the content of the .htaccess file is fed from a htaccess.conf file stored elsewhere for security purposes.

    I would suggest in future guidance it is made clear that updating the rules in the .htaccess file may or may not be done by directly changing the content of that file.

    thanks again! cheers

    Todd
    Rank Math free

    Hello,

    Every web server is unique and so the instructions vary.

    I am glad it is working fine now.

    Please do not hesitate to let us know if you need our assistance with anything else.

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

The ticket ‘The www and non-www versions of your URL are not redirected to the same site.’ is closed to new replies.