How do I do a 301 Redirect in Wordpress
-
I have several pages that are showing up as "duplicate" on my Wordpress based site based upon the structure of site. I was wondering how to do a 301 redirect for these pages
-
Hi Steven,
Alan's suggestion of installing the Wordpress SEO by Yoast plugin is right on target.
This plugin allows you to create a 301 redirect for any post and also to add the canonical link element if you prefer (only for single pages and posts).
With the plugin installed, to add a 301 redirect, just click the Advanced tab and scroll to the bottom. Enter the URL you wish to redirect the post or page to and click Update. Obviously, the plugin writes the .htaccess rule for you, but if you do want to edit the .htaccess file directly, the Yoast plugin also allows you to do this.
This plugin also includes a number of other features that allow you to deal with some of the technical shortcomings of Wordpress from an SEO point of view (duplicate content issues etc), so adds a lot of value.
Hope that helps,
Sha
-
Hi Steven,
I agree with Adam that editing the .htaccess file directly is the best way to do this, however in the interest of you not having that knowledge there are plenty of wordpress plugins that allow you to do 301 redirects either on the fly or a way that's easier to do.
Here is a link to a search on the wordpress site http://wordpress.org/extend/plugins/search.php?q=301+redirect
My preference generally is to actually search for the plugins within the Wordpress Admin panel in the menu plugins, then go to add new and type in 301 redirect in the search.From there you'll be able to see a large list along with descriptions and reviews that will help you to narrow down what plugin may suit you.
It also makes the installation process easier as you don't have to do the whole download then upload stuff it just downloads directly to your Wordpress installs and you then just have to activate it and in some plugins cases change some settings.
Word of warning though doing 301s should be really thought through before you do them as it makes it permanent so just double check you have the right URLs before you commit them. A client of mine made a huge mistake that took a while to sort out.
Also something to look at and that's plugins like SEO Yoast as that can allow you to use canonical names, which could help with some types of duplicate pages and for some pages that show up in SEOmoz's campaign reports that you don't want or need showing up. I won't go into more detail as that's not what you were asking, but I figured it's related somewhat so point you in the right direction just in case
Hope that all helps.
-
I would do it with a .htaccess file. If your hosting company has cPanel (or any other good website management software) you can do this with a gui and type the old link and the link in to your browser and hit save, or you can do it manually by creating (or editing) the .htaccess file in the root of your directory. Super fast and secure way of doing it, although you do need to be running apache (et al) not IIS.
This site has some good info on it
http://www.josiahcole.com/2007/07/11/almost-perfect-htaccess-file-for-wordpress-blogs/
As with all things there are a few ways of doing it. This seems to cover most of the exploits that .htaccess files are good at blocking including the 301 redirects.
Bear in mind that .htaccess 301s using CONDITIONS are regex and certain rules apply such as escaping characters.
so this doesnt need escaping and is simple
#redirect old to new
Redirect 301 /old.php http://www.yourdomain.com/new.phpbut this does, see the . at the end of digg.com is digg.com
#block referring domains
RewriteEngine on
RewriteCond %{HTTP_REFERER} digg.com [NC]
RewriteRule .* – [F]Once you have your 301s in place check the header return to see if its working by using a simple service like this
http://www.checkmyheaders.com/index.php
Hope it works
Adam
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
-
301 Redirect chain
I've got a redirect chain happening
On-Page Optimization | | Libra_Photographic
http > https> https.www. I can't find how to fix this one. My site is on siteground which forces the https at server level and then onto cloudflare. Anyone have any ideas?0 -
Can I just replay a backup within wordpress to regain my google ranking from yesterday?
Hi, yesterday I had a wonderful ranking for the website I do SEO for. The site is pretty still new (online since about one week). Around 11 am yesterday we ranked pretty good and challenged some local sites within the insurance business. Then I made a mistake and stuffed a part of a mail (full of keywords and comments) that was sent to me into an alt-tag of an image. Unfortunatelly it took me around 2 or 3 hours to notice. Before fixing the issue I made some other SEO changes and the site dropped on different keywords on google. Now it practically disappeared from the results… 😞 Does it make sense to just play back a backup from around 11 am yesterday or will google penalize so much going back and forth… (Meanwhile title-tag has been changed, an some alt-attributes, one of three H1s on the page to make it fit more to the title) Best regards Marc
On-Page Optimization | | RWW0 -
Redirect closing established site to another established site.
We have 2 ecommerce websites with duplicate product/category content that have been around for years. "Site A" since 2004 and "Site B" since 2011. "Site B" doesn't generate many sells and we want to close the site in fear that it may look spammy to google and since we don't want to upkeep the site. Couple questions:
On-Page Optimization | | Tuurbo
1. Is it possible that "Site B" has damaged "Site A" with google since they are so similar?
2. Can i 301 redirect all of "Site B" to "Site A" without hurting "Site A"?
3. If question 2 is ok, should i use the "Change of Address" tool in google webmaster tools to point "Site B" to "Site A"? Thanks!0 -
Photon for Wordpress experience
Has anyone tried switching on the Photon for Wordpress CDN/image caching feature? If so, did you experience any problems and have you noticed any improvements?
On-Page Optimization | | pugh0 -
Boatload of 301 Redirects Question
We have a client that came to us and they recently did a site makeover. Previously they had all their pages in root directory including 75+ spammy article pages. On their makeover, they moved all the article pages into a directory and added 301 redirects. In going over their site we noticed they have redundant articles, like an article on blue-marble-article.htm and blue-marbles-article.htm Playing on singular and plural with dulpicate content for most part with exception to making it plural. If they have 75 articles, Id say 1/3 are actually somewhat original content. I would like to 301 redirect 2/3's of the articles to better re-written article pages but that would add a whole lot more 301 redirects. We would then have a 301 redirect from root directory to article directory, then another 301 redirect from spam article to new re-written article. My question is, would this be too many redirects for googlebot to sort through and would it be too confusing or send bad signals? Or should I create a new directory with all good articles and just redirect the entire old articles directory to the new one? Or just delete the redirects and old spammy directory and let those fall on a 404 error page. Id hate to lose 50-75 pages but I think its in fact those spammy pages that could be why the site fell from top of first page google to third page and now 10th page in a years time. I know, Im confused just typing this out. Hope it makes sense for some good feedback and advise. Thanks.
On-Page Optimization | | anthonytjm0 -
301 Problem
Hi Guys, Just have a small problem with a htaccess 301 redirect. I would like to 301: www.old-domain.com & old-domain.com to www.new-domain.com. The site is exactly the same with the same directory structure so i would also like all the subpages to work. Eg: www.old-domain.com/folder/page & old-domain.com/folder/page to www.new-domain.com/folder/page Many thanks
On-Page Optimization | | MSSTORAGE0 -
How much juice do you lose in a 301 redirect?
Our site has a number of, shall we say, unoptimized URLs. I would like to change the URLs to be more relevant; if a page is about red widgets, the URL should be www.domain.com/red-widgets.html, right? I'm getting resistance on this, however, based on the belief that you lose something significant when you 301 an old URL to a new one. Now, I know that if you have a long chain of redirects, the spiders will stop following at some point, and that is a huge problem. That wouldn't apply if there's only one step in the chain, however. I've also heard that you lose some link juice in a 301, but I'm unsure how serious that problem actually is. Is it small enough that we'd win out in the long run with better-optimized URLs?
On-Page Optimization | | CMC-SD0 -
Which is better, a directory 301 redirect or each page in the directory?
A customer of mine has a site with lots of articles and they are all quite spammy. They have not been affected by penguin yet so they asked what to do. I suggested losing the articles directory and 301 redirect to either the home page or another important page. Would a 301 redirect on the entire directory to a single page be the way to go or add redirects from each page within the directory and spread out redirects to various pages in website? Or do you have a better suggestion?
On-Page Optimization | | anthonytjm0