Redirect Chain Issue
-
I keep running into a redirect chain issue trying to get a non-https/non-www domain to forward directly to the https/www domain on an Apache server. For background, we are forcing https and forcing www, but it appears the non-https/non-www domain is first redirecting to https/non-www and then redirecting again to the desired final https/www version of the domain. (Hope I am making sense here)
I am trying to find code to add to my .htaccess file that will perform the following...
301 Redirect
http://example.com directly to https://www.example.com (without 1st redirecting to https://example.com)
http://www.example.com directly to https://www.example.comAny experts in this with any thoughts?
Thanks,
Fitz -
Hi,
I was wondering exactly the same thing as above - in MOZ it classes this as a redirect chain.
Is this an issue that it picks up that isn't really a problem?
we are using:
RewriteRule (.) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !^www.MYSITE.co.uk [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.) https://www.MYSITE.co.uk/$1 [L,R=301] -
There is rewrite code to do that in one "hop". But the best practice for this has changed from what the pagespeed tools recommend, Fitz. You should actually leave the redirect as is, and insure you have HSTS properly implemented for the website. For HSTS to work properly/securely, the site must redirect to the HTTPS version of the same hostname before then redirecting to the canonical hostname. Which is exactly what your site is doing.
The only disadvantage to the extra hop is that there's a very small delay for an additional server calll, but the implementation of HSTS eliminates a server call and some certificate negotiation time. So breaks about even or even a little quicker, especially if you submit to the Preload list once you're certain HSTS is working correctly. Note that HSTS should be implemented using a very short TTL initially so you can be sure things are working correctly before switching to a long TTL and the preload list.
Do you already have HSTS configured for the site??
Paul
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
cross canonicalization with redirect
I'm working with a website that has turned one of its pages into its own website within the main website - mostly for the ease of customers, making it simpler to access that page using www.page.com rather than www.mainsite.com/about/page.
Technical SEO | | Shrine.SEO.Gal
As a result, there are two urls for that page (the ones just mentioned), both pointing to the exact same page, but with different urls. Now, they have made it so www.mainsite.com/about/page permanently redirects to www.page.com. which I thought was a good call. However, what do I do about canonicalization? Is it good to point the canonicalization of www.page.com to www.mainsite.com/about/page so that the rankings and link equity are maintained in the main website? Or would the fact that the www.mainsite.com/about/page redirects to www.page.com mess that up? I hope this makes sense!0 -
Redirects, 301's & 404's
I have tons of links that I have had added a redirect to after creating my companies new website. Is it bad to have all these 301s? How do I permanently redirect those links? Also, on Google Search Console it's telling me I have 1,000+ excluded links. Is this bad? Will it negatively affect me? Is this something to do with my sitemap? Any help would be greatly appreciated 🙂
Technical SEO | | sammecooper0 -
Http to https redirection issue
Hi, i have a website with http but now i moved to https. when i apply 301 redirection from http to https & check in semrush it shows unable to connect with https & similar other tool shows & when i remove redirection all other tools working fine but my https version doesn't get indexed in google. can anybosy help what could be the issue?
Technical SEO | | dhananjay.kumar10 -
Switched from and HTTPS to HTTP. My home page is facing a redirect issue from the http to https. Should I no index the HTTP or find the redirect and delete it? Thank you
Switched from and HTTPS to HTTP. My home page is facing a redirect issue from the http to https. Should I no index the HTTP or find the redirect and delete it? Thank you
Technical SEO | | LandmarkRecovery20170 -
Magento technical SEO issues
Hi This is lots of questions and don't expect full answers but if anyone can help or put me in touch with some who can that would be great so here are 3 issues we have from some auditing our site Firstly on pages like https://www.tidy-books.co.uk/shop-with-us/sort-by/price/sort-direction/desc so any pages where there is a sortby the cananoical link doesn't seem to be working correctly. So for here it is https://www.tidy-books.co.uk/shop-with-us/sort-by/price/sort-direction/desc"/> but should be https://www.tidy-books.co.uk/shop-with-us"/> secondly with have a lot of duplicate title tags mainly caused from the blog and the above problem see-> http://prntscr.com/b2t9xe but regarding the blog we have an issue where 2 canonical appearing for example this page
Technical SEO | | tidybooks
https://www.tidy-books.co.uk/blog/page/19/ there are 2 canonical links appearing https://www.tidy-books.co.uk/blog/page/19/"/> we want it to be this
https://www.tidy-books.co.uk/blog/"/> Thirdly
Our mobile usability issues have gone up a lot see- > http://prntscr.com/b2tado
I can see what the issue is that this folder https://www.tidy-books.co.uk/skin/frontend/tidybooks/default/images/ was being crawled by google and contains lots of 'index of' pages. I've disallowed directory in robots.txt as shown here -> http://prntscr.com/b2tbc5 is that correct? any help would be great Just to let you know we use magento v1.7 we use SEO suite ultimate extension and we use fishpigs wordpress extension thanks0 -
Questions about the Sandbox and 301 Redirects
Does the sandbox still exist? What if you have a brand new URL and do a 301 redirect from another website because the name of the service business changed? Thanks for any insight and help.
Technical SEO | | SDSLaw0 -
301 Redirects Not Allowed by Host
Not sure if anyone has an answer, but we have a client who has an ecommerce store with SBI! The client has a new site with a new store builder/host and wants to 301 redirect all of the old site's indexed pages to the new site. However, we were just informed by SBI! that 301 redirects are not allowed - even more, they don't even grant FTP access. Any brilliant ideas from anyone how we can get around this?? Thank you!
Technical SEO | | roundabout0 -
Htaccess issue
I have some urls in my site due to a rating counter. These are like: domain.com/?score=4&rew=25
Technical SEO | | sesertin
domain.com/?score=1&rew=28
domain.com/?score=5&rew=95 These are all duplicate content to my homepage and I want to 301 redirect them there. I tried so far: RedirectMatch 301 /[a-z]score[a-z] http://domain.com
RedirectMatch 301 /.score. http://domain.com
RedirectMatch 301 /^score$.* http://domain.com
RedirectMatch 301 /.^score$.* http://domain.com
RedirectMatch 301 /[a-z]score[a-z] http://domain.com
RedirectMatch 301 score http://domain.com
RedirectMatch 301 /[.]score[.] http://domain.com
RedirectMatch 301 /[.]score[.] http://domain.com
RedirectMatch 301 /[a-z,0-9]score[a-z,0-9] http://domain.com
RedirectMatch 301 /[a-z,0-9,=,&]score[a-z,0-9,=,&] http://domain.com
RedirectMatch 301 /[a-z,0-9,=&?/.]score[a-z,0-9,=&] http://domain.com None of them works. Anybody? Solution? Would be very much appriciated0