Multiple 301 Redirects on the same domain name
-
Hi,
I'd appreciate some advice ont he below.
I have a website, say www.site.co.uk that has just been redesigned using a new CMS. Previously it had URLs in the format /article.php?id=123, the new site has more friendly urls in the format /articles/article-slug.
I have been able to import the old articles into my CMS using the same article IDs and I have created a unique slug for each post. So now in my database, I have the article id (from the querystring) and a slug.
However, I have hundreds of old URLs indexed by Google in the format /article.php?id=123 and need to redirect these.
My plan was to do the following. 301 Redirect /article.php?id=123 to an intermediate page, in this case /redirect/123. On this intermediate page I would do a database lookup for the article slug, based on the ID from the querystring, create a new URL and perform a second 301 redirect to my new URL E.g. /articles/article-slug-from-database.
Whilst this works and keeps the site usable for visitors the two 301 redirects do worry me, as I don;t want Google indexing lots of /redirect/[article id] urls.
The other solution is to generate hundreds of htaccess redirect rules that map old url to the new url. The first solution is much cleaner, but the two 301's worry me. Will Google work this out on it's own, is there a better way?
Any advice is much appreciated.
Cheers
Rob
-
Great call, I hadn't thought of that. Will go that a go definitly. Cheers
-
Hi Rob,
I do not recommend the second option (using htaccess) it's a worse abuse of Apache than described above as it would have to do that for every file request (gif|html|js|css|etc)
So my solution for you is to httpd.conf and RewriteMap either by using prg: map or txt: map.
my recommendation will of course be prg: map where you can query your database
For your help http://httpd.apache.org/docs/current/rewrite/rewritemap.html
Cheers!
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
-
Google Is Indexing my 301 Redirects to Other sites
Long story but now i have a few links from my site 301 redirecting to youtube videos or eCommerce stores. They carry a considerable amount of traffic that i benefit from so i can't take them down, and that traffic is people from other websites, so basically i have backlinks from places that i don't own, to my redirect urls (Ex. http://example.com/redirect) My problem is that google is indexing them and doesn't let them go, i have tried blocking that url from robots.txt but google is still indexing it uncrawled, i have also tried allowing google to crawl it and adding noindex from robots.txt, i have tried removing it from GWT but it pops back again after a few days. Any ideas? Thanks!
Intermediate & Advanced SEO | | cuarto7150 -
How to handle multiple domains?
Hello, We are working on migrating a website to a new web server. In addition to the primary website domain, there are several other variations that are owned. Is okay if we point all of our domains to the same IP address as our primary domain, and then setup 301 redirects to the primary domain? Are there any risks in doing this? There may be about 100 domains. Many of them are different country TLD for same primary .com domain, others including misspellings of primary .com, and some that are not so related to primary domain. Thank you in advance for your response!
Intermediate & Advanced SEO | | srbello1 -
Is there any ranking benefit to buying and redirecting high PageRank domains?
Hello, I'm interested in learning how to assume ownership of a site without Google resetting the PageRank and the links back to zero. I've read that buying sites is one of the most powerful SEO "shortcuts" you can employ, but can be tricky. I've heard that, unfortunately, buying an existing domain and 301 redirecting for SEO credit is not that simple. When the WHOIS registration information on the newly purchased domain is updated to reflect its transfer to you, the new owner, that domain will almost immediately be reset by Google to a PageRank=0. That's the standard practice when a domain changes hands. Since Google is a domain registrar, obviously, change of ownership information is readily available for their use in factoring it into their algorithms. If you decide to 301 redirect the new domain to another domain you already own, you will get credit for the site's current incoming link profile, at least in the short-term. However, this purchased domain will eventually reset to PR=0 (usually during the next PageRank update) AND you will then get no credit for all of those links post-transfer. What is your experience with buying and redirecting domains?
Intermediate & Advanced SEO | | Choice0 -
301 Redirect of subdomain?
Fellow Mozzers, I'm having a hard time wrapping my brain around a redirect issue and thought it was worth posing the question to the Moz community. I did a search first but couldn't find the exact answer I was looking for. How does a 301 redirect work when you redirect a sub domain example.homepage.com to www.homepage.com but you keep the sub directories of example.homepage.com/page-1 active and are trying to rank them? I'm dealing with a current project where this is happening and this doesn't make sense to me, to redirect the subdomain if you're also trying to rank/create search traffic for pages, sub directories on example.homepage.com. This also get's into the debate of if a sub domain site is viewed as it's own website and therefore has to rank itself. If this is true, it seems like we're kind of killing the authority of the site by redirecting it. Additionally, www.homepage.com has a much stronger link profile than example.homepage.com I hope this makes sense. Any thoughts are appreciated. Thanks for your time.
Intermediate & Advanced SEO | | SMG-Texas0 -
Is it safe to 301 redirect old domain to new domain after a manual unnatural links penalty?
I have recently taken on a client that has been manually penalised for spammy link building by two previous SEOs. Having just read this excellent discussion, http://www.seomoz.org/blog/lifting-a-manual-penalty-given-by-google-personal-experience I am weighing up the odds of whether it's better to cut losses and recommend moving domains. I had thought under these circumstances it was important not to 301 the old domain to the new domain but the author (Lewis Sellers) comments on 3/4/13 that he is aware of forwards having been implemented without transferring the penalty to the new domain. http://www.seomoz.org/blog/lifting-a-manual-penalty-given-by-google-personal-experience#jtc216689 Is it safe to 301? What's the latest thinking?
Intermediate & Advanced SEO | | Ewan.Kennedy0 -
301 Redirect - What happens to backlinks
Hello... One of my sites is losing rankings in G. I received the webmaster notification of unnatural links... My question is, should i do a 301 redirect of every page on my site to a new domain? If so, do the backlinks (which i believe are causing my rankings to drop) carry over? How about the good backlinks? Also, what would happen to the rankings i currently have on page 1? Thanks
Intermediate & Advanced SEO | | Prime850 -
Questions about 301 Redirects
I have about 10 - 15 URLs that are redirecting to http://www.domainname.comwww.domainname.com/. (which is an invalid URL)The website is on a Joomla platform. Does anyone know how I can fix this? I can't figure out where the problem is coming from.
Intermediate & Advanced SEO | | JohnParker27920 -
How do I set up a 301 redirect if the default settings for our web servers create multiple URLs for the same page?
How do I set up a 301 redirect if the default settings for our web servers create multiple URLs for the same page but only views it as one page?
Intermediate & Advanced SEO | | ibex0