• Resolved ms100

    (@ms100)


    Good afternoon,
    
    Hopefully this is the right place to ask.
    
    My (Litespeed) webhosting provider, was kind enough to add this to my .htaccess file:
    
    RewriteCond %{HTTP_HOST} !^www.mydomain.nl$ [NC]
    RewriteRule (.*) https://www.mydomain.nl/$1 [R=301,L]
    
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://www.mydomain.nl%{REQUEST_URI} [R=301,L]
    
    It should prevent a multiple redirect.
    
    But when I check on https://www.redirect-checker.org/index.php, I still see:
    
    http://mydomain.nl
    301 Moved Permanently
    
    https://mydomain.nl/
    301 Moved Permanently
    
    https://www.mydomain.nl/
    200 OK
    
    Does anybody know how I can get 1 redirect, in stead of 2?
    I think this would be better:
    
    https://mydomain.nl
    301 Moved Permanently
    
    https://www.mydomain.nl/
    200 OK
    
    Could it be the .htaccess lines are correct, but there is a redirect caching that still shows the old (multiple) redirects? 
    
    Or do the lines need to be changed?
    
    Thanks in advance :)
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    redirect-checker could be showing cached data. Use your browser’s network developer tool to see the actual redirects involved. AFAICT with those rules users will get to the correct URL in one redirect.

    Thread Starter ms100

    (@ms100)

    Thanks @bcworkz for the reply ??
    My hostingprovider also thinks it might be old cache.

    When I inspect element is says one 301 redirect is used.
    So that looks good.

    But redirect-checker.org, my SEO software and GTmetrix still give a warning about multiple redirects.

    Would it be possible to remove the old cache, and than check again?

    Moderator bcworkz

    (@bcworkz)

    I think the cached data is over at redirect-checker, not on your server’s end. I don’t think there’s a way to clear that cache, other than over time. If regular visitors are only getting one redirect, it doesn’t really matter what redirect-checker is claiming.

    I’m not sure what URL redirect-checker is actually using. If an URL does not have a trailing /, WP will initiate one extra redirect to an URL with a trailing slash. Your .htaccess rules will redirect example.com to example.com/, but with any specific request like example.com/hello-world, the .htaccess rules will not add the missing trailing /. There’s probably some way for the .htaccess rules to ensure there is always a trailing /, but I’m not good enough with those rules to suggest how that might happen.

    Thread Starter ms100

    (@ms100)

    Think I found the solution @bcworkz

    Our website is using the HSTS (HTTP Strict Transport Security).

    The extra redirect is required to ensure that any browser which supports HSTS will record the HSTS entry for the top level domain, not just the subdomain.

    Thanks a lot for your help, very much appreciated

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