Advanced 301 Redirects
-
Hi all!
I'm moving a blog from a subdomain to a folder on my root domain and want to make sure I am properly implementing 301's. Is there a code or method for making specific pages 301 to the corresponding new URL without having to manually 301 each?
For example, a current blog may exist at blog.website.com/3-tips-for-selling-your-home and, since we are moving the blog, will now exist at website.com/3-tips-for-selling-your-home. We obviously want to implement 301's to ensure any link equity carries over to the new url.
Anyone know how to implement these in scale to without having to set up each manually?
Thanks!
-
I've been using regexpal for a while. I think I like regex101 better.
-
This should do it:
#begin redirect
RewriteCond %{HTTP_HOST} ^subdomain.domain.com
RewriteRule ^(.*)$ http://domain.com/subfolder/$1 [R=301]
#end redirect
Regex isn't the most intuitive thing in the world, but it's a necessary evil sometimes. Here's a nice little tool to help when you have to use it: http://regex101.com/
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
-
Index Page Redirect to Home Page? Best Practices...
Hi, I am wondering what the best practice is when a site has an index page and a home page? I have two pages, listed below, and want to know if I should 301 redirect my "index" page to my standard home page. The home page is where I would like all traffic to fall on for our website. Additionally, I used the rel=canonical tag years ago on the index page to indicate that the home page is the main content. Home Page - https://www.1099pro.com/ (PA 45) Home Page Canonical: rel="canonical" href="https://www.1099pro.com/"/> Index Page - https://www.1099pro.com/index.asp (PA - 33) Index Page Canonical: rel="canonical" href="https://www.1099pro.com/"/> It seems to me that there is some extra juice that could be passed to my home page (which is the page that ranks highly for our major keywords) by 301 redirecting the index page. Is there any reason why I should not do that? Really appreciate any help - especially with extra explanations - for the simple minded like me ;)! -Michael
Web Design | | Stew2220 -
We're considering making notable changes to our website's navigation. Other than 301 redirects from old pages to new, what do I need to consider with this type of move or update?
We would like to make some navigation changes to our website: www.NetGainIT.com, specifically to the services section. I know that I will need a list of 301 redirects if I do not plan on keeping certain pages, but what else do I need to consider?
Web Design | | NetGainTech0 -
What is the longest you would go back to ressurrect links that should have been 301's?
I have never thought of anything beyond a site that was possibly developed a month or two ago, but an interesting possible client has come along and begs a question. They had their site "redesigned" in April 2014 and it appears whomever did the work did not realize what a 301 was for. Using ahrefs or MajesticSEO, they have gone from roughly 15,000 referring pages to 500 and the time line perfectly intersects the redesign. Sooooo, just wondering if any of you geniuses has ever gone back that far to try and pull off a 301.... I am actually just thinking of a link building / content marketing plan but thought it was an interesting question. Thanks for the help, Robert
Web Design | | RobertFisher1 -
301 htaccess redirect or 301 HTTP DNS Redirect
Hi, I was wondering which you would recommend for a 301 redirect. Should we do a 301 redirect from .htacess or should we do a HTTP DNS 301 redirect. The HTTP redirect, does a redirect from the DNS Provider and doesn't require that we keep hosting the site while the htacess redirect still requires hosting. Thanks!
Web Design | | MattJD0 -
Redirection Problem
Wondering if anyone could offer some tips here please. I cannot share the site name so will try and be as detailed as possible. My client had their site on a .com domain and have decided to move to a co.uk domain. The new site has been put on the uk domain with more or less the same structure, save for pages which have been removed or merged. I am now setting up 301 redirects to tell the engines about the moved site, however this is giving me no end of grief. I can get domain.com to redirect to domain.co.uk no problems, however, if I try and redirect any of the inner pages to their new locations they all end up on the .co.uk home not where they should be. Given the homepage isn't designed to rank for all the terms. The htaccess I am using is below, I cannot see anything wrong with it, can anyone else? Redirect 301 / http://newdomain.co.uk/
Web Design | | carl_daedricdigital
Redirect 301 /villa_rental.php http://newdomain.co.uk/villa_rental.html
Redirect 301 /new_home.php http://newdomain.co.uk/new_home.html
Redirect 301 /http://newdomain.com/villas.php http://newdomain.co.uk/villastyles.html
Redirect 301 /developments.php http://newdomain.co.uk/developments.html
Redirect 301 /solana_hills.php http://newdomain.co.uk/solana_hills.html
Redirect 301 /middle_east.php http://newdomain.co.uk/middle_east.html
Redirect 301 /denia.php http://newdomain.co.uk/denia.html
Redirect 301 /faq.php http://newdomain.co.uk/faq.html I have tried both relative and full paths for the old site but doesn't make any difference. Does it matter the old site is php and the new html? many thanks0 -
Redirects (301/302) versus errors (404)
I am not able to convincingly decide between using redirects versus using 404 errors. People are giving varied opinions. Here are my cases 1. Coding errors - we put out a bad link a. Some people are saying redirect to home page; the user at least has something to do PLUS more importantly it does NOT hurt your SEO ranking. b. Counter - the page ain't there. Return 404 2. Product removed - link1 to product 1 was out there. We removed product1; so link1 is also gone. It is either lying in people's bookmarks, OR because of coding errors we left it hanging out at some places on our site.
Web Design | | proptiger0 -
301 Redirect ! Joomla Pages, Already ranking. ( just wanted to change the url
hey guys hope everyone had a new year. I am ranking for a page on my site that i want to ( not specifically move ), but just change the url name: It is too long i think and i want to move it from one portion of my architecture to another menu. I have never physically done a 301 redirect myself, always had someone do it for me. I wanted some pointers. Since it is a fairly new site 4 months old! What are my options. Do i need to 301 redirect the page, if i am changing the Structure and AI of my site, or can i just change the url as is and it will still get ranked? How do i keep that url put delete the page and redirect it ? Sorry its very simple but i wanted to get the communities help to continue on ! Best Wishes HAmpig
Web Design | | BizDetox0 -
Type of redirect?
I'm almost ready to launch a website redesign. We are going to move what's currently being hosted on olddomain.com to newdomain.com. We want to do this early to avoid error and to have olddomain.com redirect to newdomain.com until the new content is ready. Once the redesign is complete, we'll push the new content to olddomain.com (as it holds a higher SEO value) and take away the redirect. A. Does this sound like a good idea? B. What kind of redirect should I use? 302? 307? Thanks, and sorry for the confusion 🙂
Web Design | | kylesuss0