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
-
Redirecting parent subpage but leaving children as is?
Hi there, I'm working on a website where the webmaster redirected a bunch of parent pages but left the URLs of the children pages as is. For example: domain.com**/business/** got 301 redirected to domain.com**/personal** But they left behind all the children pages of /business/ as is like: domain.com/business/trips domain.com/business/travel instead of changing these to: domain.com/personal/trips domain.com/personal/travel Is there an SEO implication to the children pages_ /business/trips_ and /business/travel having a redirecting parent? Will it affect robots crawling or link equity passing?
Technical SEO | | NikkiHernandez0 -
301 redirects - an ongoing argument in our agency
ok fellow marketers. we have an on-going argument in our office regarding 301 redirects. for seo best practices, should a 301 be done at the registrar level or in the htaccess file. We have arguments going both ways and I'd love to hear what everyone has to say about it. Thanks, Stephan
Technical SEO | | Stephan_Boehringer0 -
301 redirect of a subdirectory
Hello! I am working on a website with the following structure: example.com/sub1/sub2/sub3. The page "example.com/sub1" does not exist (I know this is not the optimal architecture to have this be a nonexistent page). But someone might type that address, so I would like it to redirect it to example.com/sub1/sub2/sub3. I tried the following redirect: redirect 301 /sub1 http://example.com/sub1/sub2/sub3. But with this redirect in place, if I go to example.com/sub1, I get redirected to example.com/sub1/sub2/sub3/sub2/sub3 (the redirect just inserts extra subdirectories). If someone types "example.com/sub1" into a browser, I would "example.com/sub1/sub2/sub3" to come up. Is this possible? Thank you!
Technical SEO | | nyc-seo0 -
IP redirects
My website, on a .com domain, displays a different language/content depending on the IP of the user. For example, if someone is browsing my web from Spain, it will show the spanish content, and so on. Does anyone has an idea on how will Google index my pages? Their servers being located in the US, I assume the bot will only crawl and index the english content. How can I tell the bots to do the same for the other languages/content? Thanks!
Technical SEO | | Alemoto0 -
Redirecting 404
Hi. I'm working on a wordpress site, which got some old deleted pages indexed and now shows a 404 (also in the results) As these old pages earlier got content and probably also some links pointing towards it, what would then be best practice to do? Should i make an 301 redirect? Make the 404 noindex?
Technical SEO | | Mickelp0 -
How do find where a 301 redirect is located
My report says I have http://www.30minuteseder.com/Passover.blog redirected to http://30minuteseder.com/Passover.blog. It is correct, but I can't find where the 301 redirect is located. I looked in my .htaccess file in the root and it's not there. How do I find it so I can change it?
Technical SEO | | Sederman0 -
Redirects
If I redirect page A to page B does page A need to exist before Google sees the redirect. Or can I just put up a redirect and delete page A. If the page doesn't need to exist: You have all your redirects in place for a website. You want this website to redirect to another website. You completely delete the website and put up the htaccess, there should be no problem with this, because the redirects are in place correct? Thanks
Technical SEO | | tylerfraser0 -
301 Redirect Question
I'm working on a site that has a lot of indexed pages and backlinks to both domain.com and www.domain.com. Will using a 301 redirect to send domain.com to www.domain.com merge all of the indexed pages and links over to www.domain.com, thereby strengthening the www?
Technical SEO | | Yo_Adrian0