301 Redirect for multiple links
-
I just relaunched my website and changed a permalink structure for several pages where only a subdirectory name changed.
What 301 Redirect code do I use to redirect the following? I have dozens of these where I need to change just the directory name from "urban-living" to "urban", and want it to catch the following all in one redirect command.
Here is an example of the structure that needs to change.
Old
domain.com/urban-living (single page w/ content)
domain.com/urban-living/tempe (single page w/ content)
domain.com/urban-living/tempe/the-vale (single page w/ content)New
domain.com/urban
domain.com/urban/tempe
domain.com/urban/tempe/the-vale -
Glad it works!
-
Got it. That works. I was using Yoast Premium Redirect tools.
RewriteRule ^(.)urban-living(.)$ yoursite.com/$1urban$2 [R=301,L] the "yoursite.com/" wasn't necessary.
This did the trick. RewriteRule ^(.)urban-living(.)$ /$1urban$2 [R=301,L]
Thanks!
-
Yeah, that would be a lot of lines to add manuall., I would try the htaccess Rewrite function.
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /RewriteRule ^(.)urban-living(.)$ yoursite.com/$1urban$2 [R=301,L]</ifmodule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{HTTP_HOST} !^www.yoursite.com$ [NC]
RewriteRule ^(.*)$ yoursite.com//$1 [L,R=301]I'm not an htaccess expert, so I'm not 100% sure that it will work, if not you can check out this stack overflow thread for an explanation of the code used above.
-
I have more than a dozen... dozenS as in plural. There are 80 pages with this and want to use a single command to capture all of them, not do them individually.
Is there a way to to that?
-
Since you only have a dozen of URLs you could just do a simple 301 redirect in your .htaccess file or you can get a little more technical and do a RewriteRule that would 301 "urban-living" to "urban'
.htaccess 301 Redirect
Redirect 301/urban-living /urban
Redirect 301/urban-living/tempe /urban/tempe
Redirect 301/urban-living/tempe/the-vale /urban/tempe/the-valeHope this helps, if not, let me know if you have any questions!
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
-
After you remove a 301 redirect that Google has processed, will the new URL retain any of the link equity from the old URL?
Lets say you 301 redirect URL A to URL B, and URL A has some backlinks from other sites. Say you left the 301 redirect in place for a year, and Google had already replaced the old URL with the new URL in the SERPs, would the new URL (B) retain some of the link equity from URL A after the 301 redirect was removed, or does the redirect have to remain in place forever?
Technical SEO | | johnwalkersmith0 -
301 redirect file question
Hi Everyone, I am creating a list of 301 redirects to give to a developer to put into Magento. I used Screaming Frog to crawl the site, but I have noticed that all of their urls 302 to another page. I am wondering if I should 301 the first URL to the url on the new site, or the second. I am thinking the first, but would love some confirmation. Thank you!
Technical SEO | | mrbobland0 -
301 redirects- how long to keep and how many are too many?
Hi, I was told we have way too many 301 redirects on our site. We have some that have been there for 3 years. Our site is datacard.com . Question- how long should you keep a redirect out there when building a new page and expiring an old page? Is it 6 months, is it a certain time frame? wondering what the best practices are? Thanks! Laura
Technical SEO | | lauramrobinson320 -
HTacess 301 redirect with special characters
Hello moz community ! I would to make a special 301 redirection through my htaccess file. I am a total noob concerning regexp and 301 redirection. I would like to redirect(301) this url : http://www.legipermis.com/stages-points/">http://www.legipermis.com/stages-points/</a></p>; yes yes it's in the index of google, this strange url includes the last ; to http://www.legipermis.com/stages-points/ I have already include a canonical tag by security, i would like to remove url with a 301 redirection and by remove this url through GWT (but the removal tool can't "eat' this kind of URL) Please consider the fact that i am not an expert about 301 redirections and regexps. No 301 redirect generator works properly for such a strange URL (which triggers content duplication corrected anyway with canonical tag). Thanks for your help.
Technical SEO | | LegiPermis0 -
Blogger to Wordpress 301 and Meta Refresher Redirect
Hi Everyone! So my client has a blogger that she has developed a good amount of link equity for. It is a hersite.blogspot.com (she doesn't own her own domain yet). She is moving to the Wordpress platform though and the only way we can do a redirect is through a meta refresh redirect (since she doesn't have access to the servers on blogger). I went to Google Webmasters to do a change of address and found that the 301 checker said it couldn't find any 301 redirect, which is disappointing. What we're planning is telling all the places that link to the blog to change their links to the new blog but other than that what does anyone recommend to keep this link strength? Thanks!
Technical SEO | | mattdinbrooklyn0 -
301 and 302 for same link
Just trying to find out if this may be the root of a slight traffic dip and also if we should be redirecting differently. We relaunched and did 301 redirects to the new site, initially. Then, we decided to change from http to https. Our HTTP status now looks like this when using the MozBar: HTTP/1.1 301 Moved Permanently – http://site.com/oldurl
Technical SEO | | MichaelEka
HTTP/1.1 302 Found – https://site.com/oldurl
HTTP/1.1 200 OK - https://site.com/new Should we be changing that 302 to a 301? Are we losing link equity due to this? Thanks.0 -
Merging multiple sites and contacting linking domains
This is strictly academic but I am having a friendly debate and I am hoping you guys could help me. If I decided that I wanted to merge several websites into a single new URL doing everything I am supposed to (page to page 301 redirects, etc), will I still need to reach out to those important websites that link to my different sites to have them change the links and anchor text to point to the new site? I know that 90% of the link juice is supposed to transfer and that you are SUPPOSED to contact linking domains, but is it really worth it, especially if there are literally hundreds of sites to contact?
Technical SEO | | Mike_Davis0 -
Google , 301 redirects, and multiple domains pointing to the same content.
Google, 301 redirects, and multiple domains pointing to the same content. This is my first post here. I would like to begin by thanking anyone in advance for their help. It is much appreciated. Secondly, I'm posting in the wrong place or something please forgive me simply point me in the right direction I'm a quick learner. I think I'm battling a redirect problem but I want to be sure before I make changes. In order to accurately assess the situation a little background is necessary. I have had a site called tx-laws.com for about 15 years. It was a site that was used primarily by private resource and as such was never SEO'd. The site itself was in fact quite Seo unfriendly. despite a complete lack of marketing or SEO efforts, over time, SEO aside, this domain eventually made it to page one of Google Yahoo and Bing under the keywords Texas laws. About six months ago I decided to revamp the site and create a new resource aimed at a public market. A good deal of effort was made to re-work the SEO. The new site was developed at a different domain name: easylawlook up.com. Within a few months this domain name surpassed tx-laws in Google and was holding its place in position number eight out of 190 million results. Note that at this point no marketing has been done, that is to say there has been no social networking, no e-mail campaigns, no blogs, -- nothing but content. All was well until a few weeks ago I decided to upgrade our network and our servers. During this period there was some downtime unfortunately. When the upgrade was complete everything seemed fine until a week or so later when our primary domain easy law look up vanished off Google. At first I thought it was downtime but now I'm not so sure. The current configuration reroutes traffic from tx-laws to easylawlookup in IIS by pointing both domains to the same root directory. Everything else was handled through scripting. As far as I know this is how it was always set up. At present there is no 301 Redirect in place for tx-laws (as I'm sure there probably should be). Interestingly enough the back links to easylaw also went away. Even more telling however is that now when I visit link: easylawlookup.com there is only one link, and that link is to a domain which references tx-laws not easy law. So it would appear that I have confused Google with regards to my actual intentions. My question is this. Right now my rankings for tx-laws remain unchanged. The last thing I want to have happen is to see those disappear as well. If easy law has somehow been penalized and I redirect tx-laws to easy through a 301 will I screw up my rankings for this domain as well? Any comments or input on the situation are welcome. I just want to think it through before I start making more changes which might make things worse instead of better. Ultimately though, there is no reason that the old domain can't be redirected to the new domain at this point unless it would mean that I run the risk of losing my listings for tx-laws, ending up with nothing instead of transferring any link juice and traffic to easy law. With regards to the down time, it was substantial over a couple of weeks with many hours off-line. However this downtime would have affected both domains the only difference being that the one domain had been in existence for 15 years as opposed to six months for the other. So is my problem downtime, lack of proper 301 redirect, or something else? and if I implement a 301 at this point do I risk damaging the remaining domain which is operational? Thanks again for any help.
Technical SEO | | Steviebone0