Viewing 4 replies - 1 through 4 (of 4 total)
  • Justin

    (@justingreerinteractive)

    What are you using for the redirect (.htaccess, DNS) ?

    Using .htaccess (if DNS is not trumping the redirect) can be written something like

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

    The above will redirect to a non-www version and keep the request URI

    Thread Starter wattyrev

    (@wattyrev)

    How can I determine how it is being redirected? I have a .htaccess file, and I have been messing with it but havent noticed any changes so far. Even if I delete the .htaccess, everything acts the same.

    Justin

    (@justingreerinteractive)

    Put this code at the very top of your .htaccess file.

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

    If you can go to your domain using www. and you are not forwarded to the non-www version, then more than likely your DNS is the one redirecting and you will have to setup your DNS correctly.

    I just recently had this issue with a client. Lets say someone visited https://www.domain.com/blog/this-is-a-page-title, they would be redirect to https://domain.com instead.

    if you do not know how to edit your DNS settings then I would contact your hosting provider and ask them to do it or you

    Thread Starter wattyrev

    (@wattyrev)

    I put that into the top of my .htaccess, and nothing changes. All the behavior is exactly the same.

    I’m having someone look into the DNS settings as well. Unfortunately, I don’t have access to that myself.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Strange www redirect’ is closed to new replies.