301 redirect hops from non-https and www
-
It's best practice to minimize the amount of 301 redirect hops. Ideally only one redirect hop.
It's also best practice to 301 redirect (or at least canonical) your non-https and/or your non-www (or www) to the canonical protocol/subdomain.
The simplest (and possibly the most common) way to implement canonical protocol/subdomain redirects is through a load balancer or before your app processes the request. Both of which will just blanket 301 to the canonical domain/protocol regardless if the path exists or not
In which case, you could have:
- Two hops. i.e. hop #1 http://example.com/foo to https://example.com/foo, hop #2 https://example.com/foo to https://example.com/bar
- 301 to a 404. Let's say https://example.com/dog never existed, but somebody for whatever reason linked to it (maybe a typo). If I request https://www.example.com/dog, the load balancer would 301 to a 404 page.
Either scenario above should be fairly rare. However, you can't control how people link to you. Should I care about either above scenario? I could have my app attempt to check if the page exists before forwarding, but that code could be complicated.
-
Maybe I'm missing something? You can implement an htaccess rewrite rule (or equivalent for your server stack) using regex/host so that essentially
http://example.com/foo OR https://example.com/foo redirect to https://example.com/bar That's the standard approach and serves in one hop. Is there something I'm missing why you're getting into a load balancer etc to accomplish this?P.
-
Hello there,
I´d suggest you to go for the Option 1: two hops.
Google understands well up to 4-5 hops. Matt Cutts said it in these videos:
Can too many redirects from a single URL have a negative effect on crawling? Is there a limit to how many 301 (Permanent) redirects I can do on a site?Also, I think that setting a 301 to a 404, it would give to GoogleBot mixed signals and there could be some cases where you get some links to that 301->404 page and lost that ones.
Best luck!
GR.
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 from query string to new static page
If i want to create a redirect from a page where the slug ends like this "/?i=4839&mid=1000&id=41537" to a static, more SEO friendly slug like "/contact-us/", will a standard 301 redirect suffice? Thanks, Nails
Intermediate & Advanced SEO | | matt.nails0 -
Client would like to 301 redirect the homepage to a category page
Hello MOZ Community!!! I would like your expert opinions on a scenario, please! My client is an ecommerce company, and currently has one of its category pages outranking its homepage for a few key phrases. The homepage, however, has a better conversion rate. So, the client is asking that we make the homepage the category URL, so http://www.theirsite.com/blue-clothes. The existing homepage URL - http://www.theirsite.com - would 301 REDIRECT to the category page - which would render the current version of the homepage. Therefore, there would be nothing, ZERO content, on the MAIN URL: http://www.theirsite.com Has anyone ever done this before? What are the pros and the cons of this practice? Here is my same client, for reference: https://moz.com/community/q/issue-with-category-ranking-on-page-1-vs-homepage-ranking-on-page-2
Intermediate & Advanced SEO | | accpar0 -
Client has moved to secured https webpages but non secured http pages are still being indexed in Google. Is this an issue
We are currently working with a client that relaunched their website two months ago to have hypertext transfer protocol secure pages (https) across their entire site architecture. The problem is that their non secure (http) pages are still accessible and being indexed in Google. Here are our concerns: 1. Are co-existing non secure and secure webpages (http and https) considered duplicate content?
Intermediate & Advanced SEO | | VanguardCommunications
2. If these pages are duplicate content should we use 301 redirects or rel canonicals?
3. If we go with rel canonicals, is it okay for a non secure page to have rel canonical to the secure version? Thanks for the advice.0 -
What is the Proper Use of 301 redirects for SEO purposes?
I heard and read from different sources that 301 redirects from aged domains with healthy link profiles is great to boost a sites rank as oppose to building a site around the page and linking it to the domain you want to rank. Whats is the best practice for this strategy? Thanks
Intermediate & Advanced SEO | | junkcars0 -
Lost all ranking after site-wide 301 redirect
Hi all I did a complete site-wide 310 redirect about 3 weeks ago for a site that had consistently been in Pos 1-5 for my targeted keyword ("low glycemic foods"). I changed the domain from low-glycemic-foods-org to low-glycemic-diet.com because I thought that was a more appropriate title and thru my readings I believed that if I carefully followed the recommended procedures I would quickly regain my SERP. Webmaster tools is showing that I have over 800 inbound links - many from very trustworthy sources including .edu, etc BUT my home page is nowhere to be found for the keyword search "low glycemic diet". My Seomoz onpage SEO score is an "A" Any enlightenment would be much appreciated.
Intermediate & Advanced SEO | | veezer0 -
301 redirect via htaccess question
So, I have www.sitea.com and www.siteb.com I want to redirect SOME pages from www.sitea.com to www.siteb.com (example: www.sitea.com/plugins/wp/ to www.siteb/wp/ etc ) and the rest of any pages left, to the homepage of www.siteb.com. It is something with conditions... any help, please?
Intermediate & Advanced SEO | | jasmin280 -
Root domain or sub domain? WWW. or NOT WWW......
I am a little confused! I use vidahost whom I have to say I find very helpful. I currently have the domains www.fentonit.co.uk and www.fentonit.com, now the websites was set up using the www.fentonit.com and I have www.fentonit.co.uk as a parked domain pointed to the www.fentonit.com. Confused yet? Now because I wanted the website to show www.fentonit.co.uk I added some code I was given by the guys to the .hta access file and viola up it comes as the .co.uk which is what I wanted. So if your still here and havent A: Killed yourself yet or B: Went to the Pub Then my questions are: 1. Is there going to be an issue from an SEO point of view having my site set up this way and if so how do I resolve it? 2. Would I be better using the root domain fentonit.co.uk (I think this is the root domain, although it iscurrently parked and pointed) as opposed to the sub www domain?.......and finally.......? 3. If it is set up as I stated what exactly would be my root domain, would it be the .co.uk or the .com? Sorry and I completely understand if your not interested in answering it but if you do.....Thanks in advance and I'll take you to the pub...lol Craig www.fentonit.co.uk ( i think)
Intermediate & Advanced SEO | | craigyboy1 -
301 redirect for duplicate content
Hey, I have just started working on a site which is a video based city guide, with promotional videos for restaurants, bars, activities,etc. The first thing that I have noticed is that every video on the site has two possible urls:- http://www.domain.com/venue.php?url=rosemarino
Intermediate & Advanced SEO | | AdeLewis
http://www.domain.com/venue/rosemarino I know that I can write a .htaccess line to redirect one to the other:- redirect 301 /venue.php?url=rosemarino http://www.domain.com/venue/rosemarino but this would involve creating a .htaccess line for every video on the site and new videos that get added may get missed. Does anyone know a way of creating a rule to rewrite these urls? Any help would be most gratefully received. Thanks. Ade.0