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
-
301 Redirect Review Nodes
I have a client who rents out vacation beach rentals. They currently have thousands of homes under management. Each property has its own internal reviewing platform. Reviews are not really intended to be viewed on their own, as in a stand alone page with just the review on it. The problem is that Drupal makes just about every type of node viewable on its own dedicated URL. I was just thinking about taking request to view stand alone reviews and 301’ing them to their respective property page, the context in which they are intended to be viewed. The website has about 2500 review nodes currently crawlable via Drupal that sit on their own URLs. Would there be a material impact to 301 them to their respective property page when any attempt to view them on their own is made to the site?
Technical SEO | | conversionpipeline20 -
Disavow Issues
Hi We have a client who was hit by Penguin about 18 months ago. We disavowed all the bad links about 10 months ago however this has not resulted in an uplift in traffic or rankings. The client is asking me whether it would be better to dump the domain and move the website to a fresh domain. Can you provide thoughts / experience on this please? Thanks.
Technical SEO | | EffectiveSEOUK0 -
Server redirect query
Hi there, due to so much traffic coming through to our e-commerce site our host is going to do an apache re-direct for over flow traffic from www.mywebsite.com to a ww2.mywebsite.com canonical tags will be in, but if there is a re-direct this is surely bad for seo, telling on onccasions the page has moved? Any advice on this and the best way to re-direct users when there is too much traffic please let me know.
Technical SEO | | pauledwards0 -
Duplicate Content Issues
We have some "?src=" tag in some URL's which are treated as duplicate content in the crawl diagnostics errors? For example, xyz.com?src=abc and xyz.com?src=def are considered to be duplicate content url's. My objective is to make my campaign free of these crawl errors. First of all i would like to know why these url's are considered to have duplicate content. And what's the best solution to get rid of this?
Technical SEO | | RodrigoVaca0 -
301 Redirect Help
How would you 301 redirect and entire folder to a specific file within the same domain? Scenario www.domain.com/folder to www.domain.com/file.html Thanks for your Input...
Technical SEO | | dhidalgo11 -
Duplicate Homepage issue
SEOMOZ says my site has two homepages: www.mysite.com www.mysite.com/ When you go to "www.mysite.com/" the URL changes to "www.mysite.com" Why is this happening and what can I do about it?
Technical SEO | | LucasF0 -
What's the issue?
Hi, We have a client who dropped in the rankings (initially from bottom of the first page to page to page 3, and now page 5) for a single keyword (their most important one - targeted on their homepage) back in the middle of March. So far, we've found that the issue isn't the following: Keyword stuffing on the page External anchor text pointing to the page Internal anchor text pointing to the page In addition to the above, the drop didn't coincide with panda or penguin. Any other ideas as to what could cause such a drop for a single keyword (other related rankings haven't moved). We're starting to think that this may just have been another small change in the algorithm but it seems like too big of a drop in a short space of time for that to be the case. Any thoughts would be much appreciated! Thanks.
Technical SEO | | jasarrow0 -
How long should I keep 301 redirects?
I have modified a the URL structure of a whole section of a website and used mod_rewrite 301 redirect to match the new structure. Now that was around 3 months ago and I was wondering how long should I keep this redirect for? As it is a new website I am quite sure that there are no links around with the old URL structure but still I can see the google bot trying from time to time to access the old URL structure. Shouldn't the google bot learn from this 301 redirect and not go anymore for the old URL?
Technical SEO | | socialtowards0