How to avoid a redirect chain?
-
Hi there,
I am aware that it is not good practice to have a redirect chain but I am not really sure hoe to do it (on Apache).
I have multiple redirects in a chain because on the one hand I had to redirect because the content of the site got a new URL and because on the other hand I changed from http to https. Thus I have a chain like
http://example.com via 301 to http://the-best-example.com via 301 to https://the-best-example.com via 301 to https://greatest-example.com
Obviously I want to clean this up without loosing any link juice or visitors who had bookmarked my site. So, I could make three separate redirects:
http://example.com via 301 to https://greatest-example.com
http://the-best-example.com via 301 to https://greatest-example.com
https://the-best-example.com via 301 to https://greatest-example.comBut is there a way to combine it? Can I use an "OR" operator to link the 3 conditions to this one rule?
Any other suggestions?
Thanks a lot!!!
-
this is simple. rather that test what the domain name is, test what it is not.
use the logic,
if not my-preferred-domainname then redirect to my-preferred-domainname.
-
Hey there
I would also make sure that your sitemap and internal links are up to date so that there are no redirects happening in those places. You may also want to make sure you take the time to update listings and do a quick backlink audit to see if there are links you wish to update or possibly remove.
Hope this helps as well - good luck!
-
yeah, thanks. That helps.
-
Hi,
In a situation like this I would use something similar to:
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^.+.example.com$ [OR]
RewriteCond %{REMOTE_HOST} !^.+.the-best-example.com$
RewriteRule ^(/~.+) https://greatest-example.com/$1 [R,L](Sorry this was written off the top of my head, so give it a test before rolling it out!)
Kind Regards
Jimmy
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
-
Redirect chain being flagged in Moz
I have a redirect chain being flagged in Moz, this is the first time I have come across this, and Im convinced its causing an issue, the site is performing very badly. I have attached screen grabs of the redirect chain. and the site is cotswold flat roofing Is this redirect chain causing me an issue, and what is the best practice for getting it fixed or removed, the site currenly does not even show up in Google even when searching for its won brand, I removed an x robot noindex a week ago, and now the only issue that I can see is this redirect chain 6pOpGNU
Technical SEO | | Donsimong0 -
How to change 302 redirect from http to https
Hi gang. Our site currently has a 302 redirect from the HTTP version of the homepage to the HTTPS version of the homepage. I understand this really should be changed to a 301 redirect but I'm having a little trouble figuring out exactly how this should be done. Some places on the internet are telling me I can edit our htaccess file to specify the type of redirect, however our htaccess file seems to be missing some of the information in theirs. Can anyone tell me what needs to be changed in the htaccess file - or if there's a simpler way to change the 302 to a 301? Many thanks 🙂 htaccess: BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] END WordPress EXPIRES CACHING ExpiresActive On ExpiresByType image/jpg "access plus 6 months" ExpiresByType image/jpeg "access plus 6 months" ExpiresByType image/gif "access plus 6 months" ExpiresByType image/png "access plus 6 months" ExpiresByType text/css "access plus 10 days" ExpiresByType application/pdf "access plus 10 days" ExpiresByType application/x-shockwave-flash "access plus 10 days" ExpiresByType image/x-icon "access plus 6 months" ExpiresDefault "access plus 2 days" EXPIRES CACHING
Technical SEO | | davedon0 -
Redirect typo domains
Hi, What's the "correct" way of redirecting typo domains? DNS A record goes to the same ip address as the correct domain name Then 301 redirects for each typo domain in the .htaccess Subdomains on typo urls still redirect to www or should they redirect to the subdomain on the correct url in case the subdomain exists?
Technical SEO | | kuchenchef0 -
.htaccess redirect question
Hi guys and girls Please forgive me for being an apache noob, but I've been trawling for a while now and i can't seem to find a definitive guide for my current scenario. I've walked into a but of a cluster$%*! of a job, to rescue a horribly set up site. One of many, many problems is that they have 132 302redirects set up. Some of these are identical pages but http-https, others are the same but https-http and some are redirects to different content pages with http-http. A uniform redirecting of http to https is not an option so I'm looking to find out the best practice for reconfiguring these 302s to 301s within .htaccess? Thanks in advance 🙂
Technical SEO | | craig.gto0 -
301 Redirect domain with penalty
Wondering if I could get a few views on this please... I have added an affiliate store to a domain I own, however I forgot to noindex the product pages which were duplicate content of the merchants. Despite a good deal of backlink building the site will not do much in the engines at all, doesn't even come up on the first few pages for it's own name! This suggests to me that I have a duplicate content penalty. Try as I may I cannot get it removed so am thinking of cloning the domain to a new domain, however, I do not want to lose the links I collected so I am planning on 301ing them. While I will not get all the link power moved over, I should at least get credit for some of them which will kick start the new domain. Can anyone forsee any potential issues with doing this? Is there a danger of 301ing a site with a penalty that the penalty would be carried over? I know there is no penalty on the links, no WMT warnings etc, it is the content causing the issue. Thanks, Carl
Technical SEO | | Grumpy_Carl0 -
How to avoid automated queries to Google
We have a search engine marketing team working on different projects and we share same IP. We check our rankings manually on Google, is it sending automated queries to Google? Can it affect our sites? What solution do you suggest to check rankings without sending multiple queries to Google?
Technical SEO | | koamit0 -
Setup 301 Redirects
I have been asked to transfer a clients old domain over to a new domain with a new site. All of the inbound links basically go to the homepage, and the few links that dont go to the homepage on the old site, might as well be redirected to the homepage on the new site. I'm wondering is there a "catch all" sort of redirect such as www.oldsite.com/* redirects to newsite.com. So any redirects we havent set up will automatically go to the new site homepage? And secondly, whats the easiest way to the redirects up? Can I just add it as a parked domain or addon domain in cpanel, and do the redirects in there? Or does it needs its own hosting for the old domain with its own htaccess file? Any help appreciated! 🙂
Technical SEO | | timscullin0 -
Redirect Flash Site for Google Only - Is this against TOS?
A photographer client has a flash website, purchased as from a (well respected) template company. The main site is at the root domain, and the HTML version is at www.example.com/?load=html If I visit the site on a browser without Flash installed, I am re-directed automatically to the HTML version. I'm concerned as the site has some great links and the HTML version is well optimised, but doesn't appear anywhere in Google for chosen keywords (ranks perfectly for brand related searches). Google is indexing the Flash version of the site, but I would rather it didn't (there's no real content (just Javascript to load the SWF) and all of the pages load under one URL). How can I block the Flash version from Google but still make the incoming links count towards the HTMl version of the site? If I re-direct Google to the HTML version, is this cloaking, and is it frowned upon? Thanks for any advice you can offer.
Technical SEO | | cmaddison0