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
-
Is page rank lost through a 301 redirect?
Hi everyone. I'd really appreciate your help with this one 🙂 I've just watched Matt Cutt's video 'what percentage of PageRank is lost through a 301 redirect?' and I am confused. I had taken this to mean that a re-direct would always lose you page rank, but watching it again I am not so sure. He says that the amount of page rank lost through a 301 redirect is the same as any other link. Does this mean that no page rank at all is lost during site migrations? Or is it the case that first page rank would be lost from the original link and then more page rank would be lost from any subsequent redirects? watch?v=Filv4pP-1nw
Technical SEO | | RG_SEO0 -
Where is the 301 redirect?
Hi, in the last week I take an issue for 301 permanent redirect for a subfolder in the main website! In that folder i have a index.php file for a google map fullscreen edition and the only link who connects the wordpress website with the subfolder is only a direct link! Is that an error of seomoz app or something else? Thanks 1.jpg
Technical SEO | | petrospan0 -
Page authority has disappeared since redirect
As the title states, my page authority (PA) has completely disappeared for certain pages on my site.
Technical SEO | | Hughescov
I have recently had a redesign and optimised the page names, redirecting the page it has replaced.
This has been nearly 2 months now and the new pages are showing PA of 1 still.
The 301 redirects definitely work so what am I doing wrong? Thanks in advance!0 -
301 Redirect on a PDF, DOCX files?
Hi, I have to rename many pdf and docx files. How can I implement 301 redirect on them as they are linked from 'n' number of places? Regards, Shailendra Sial
Technical SEO | | IM_Learner1 -
How long should you keep 301 redirects?
Hi, Back in 2009 I decided to update an older site from .htm and .shtml to .php. In order to minimize the impact I would go in every month and do a 301 redirect on the .shtml page to the new .php page. So I have many that range from 2009 through 2010. I had left the old 301's because I felt they would only be used if needed but I would think I should clean up my .htaccess by removing the old 301 redirects if they are not needed. How long should you keep this type of 301 redirect? Thanks!
Technical SEO | | Force70 -
Someone is redirecting their url to mine
Hello, I have just discovered that a company in Poland www.realpilot.pl is directing their domain to ours www.transair.co.uk. We have not authorised this, neither do we want this. I have contacted the company and the webmaster to get it removed. If you search for the domain name www.realpilot.pl we (www.transair.co.uk) come up top. My biggest worry is that we will get penalised by Google for this re-direct as it appears to be done using some kind of frame. Does anyone know anything about this kind of thing? Many Thanks Rob Martin
Technical SEO | | brightonseorob0 -
Parked Domain blog directory not redirecting
My newly parked domain name, (our main website had to switch primary domains) is not redirecting properly and is causing our blog to be duplicate content. My 301 redirects work for everything else, but our parked domain /blog directory is not redirecting. I can type in both urls and then the blog appears on both sites. Not good. If I delete my blog .htaccess file, then it redirects fine. However, then our blog links are broken. So it has to do something with our .htaccess files. I do have a .htaccess file for our website, saying redirect everything to correct location, so i think this is interfering, but I cannot pinpoint it. this is the .htaccess file for the blog. BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
Technical SEO | | hfranz
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]</ifmodule> END WordPress main sites .htaccess (i am trying to pinpoint the issue here) Options +Includes
AddType text/html .htm .html
AddHandler server-parsed .htm .html
Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(www.)?parkeddomain.com [NC,OR] RewriteCond %{HTTP_HOST} ^newdomain.com [NC] RewriteRule (.*) http://www.newdomain/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?]*)? RewriteRule (.*) /$1? [R=301,L] RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ http://www.newdomain.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^.*/index.htm RewriteRule ^(.*)index.htm$ http://www.newdomain/$1 [R=301,L] RedirectMatch 301 /index.php/(.*) /$1 Is there something obvious here, that does not look right?0 -
How do I redirect non-www to www in IIS?
There is a lot of talk about this all over this site (and other's), but just about every solution mentions using the .htaccess file, which is only a solution for Apache. My sites are in a shared windows environment, so that won't work for me. I have access to the IIS manager for the server, and have several page-level redirects in place. My issue is that I cannot find a clear and easy way to re-direct my root (domain.com) domain, to my preferred specific domain (www.domain.com). I found a few articles online relating to a URL re-write module for IIS, but am not sure if I will be able to install that on a shared web server. Is there another way to accomplish my goal of not having 2 indexable versions of my site? I have rel-canonical tags on every page, but would prefer a more trustworthy and established solution. Thanks for any help you can offer. -Dave
Technical SEO | | dschapira0