redirect www to non-www

#406867
  • Resolved Brian Sekerak
    Rank Math free

    Hi I’m trying to redirect www to non-www on my site, but the code is not working. I have tried both
    RewriteEngine On
    RewriteCond %{HTTP_HOST} http://www.example.com
    RewriteRule (.*) https://example.com/$1 [R=301,L]
    and
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.website.com [NC]
    RewriteRule ^(.*)$ https://website.com/$1 [L,R=301]

    replacing the example and website with lashmenyc but nothing works. I cleared cache, and did the following
    Then, navigate to Rank Math > Status & Tools > Database Tools > Flush SEO analysis data and Remove Rank Math Transients, then perform SEO analysis again and see if the results are updated.

Viewing 1 replies (of 1 total)
  • Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting the support and we regret the inconvenience caused.

    For the first code, as you’re adding {HTTP_HOST}, you do not need to include http:// in the URL.

    Assuming lashmenyc.com is your domain, please try the below code and see if that helps:

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

    After adding the code, please clear your website, browser, and server’s cache (if any) and see if that helps.

    Let us know how that goes.

    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 1 replies (of 1 total)

The ticket ‘redirect www to non-www’ is closed to new replies.