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 and the base URL
Hi, please bear with me as I'm pretty new to all this! I've my base URL but obviously want to add keywords to it for seo purposes. Should I redirect from the base URL to the URL with the keywords appended? So my landing page goes from say www.moz.com to www.moz.com/keywords-here. If I do that, should I replicate all the meta data (descriptions etc) on the original landing page? Or does it not matter? Thanks, Nick
On-Page Optimization | | nickwoodward0 -
301 Redirect from .html
Hi there, Following on from this post:
On-Page Optimization | | finelinewebsolutions
http://moz.com/community/q/help-with-duplicated-content Please could one confirm that using the following code in our htaccess file will stop the duplicated content issue we are having. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+.)+html?\ HTTP
RewriteRule (.+).html?$ http://www.bereavementstationery.co.uk/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html Kind Regards Alec0 -
AD on wordpress
I notice advertisement hyperlinks on my site such as hyperlinks on my test gift, fill out etc. I never put hose links but somehow it shows up on firefox. Does anyone experience this? It's showing up this url http://www.soobumimphotography.com/portfolio/wedding/
On-Page Optimization | | BistosAmerica0 -
Redirecting URLS on windows
Could anyone help out here please. A client of ours have reveloped their website from HTML to ASP (helpful!). They have 60 odd pages indexed in Google with the .html extension. We need to do a redirect on these pages so that all link juice is passed to the new pages. What would be the best way to do this please?
On-Page Optimization | | Grumpy_Carl0 -
Wordpress Shortcodes Showing in SERPs
We use some Wordpress shortcodes in our theme and they aren't in the meta description at all. For certain queries, the shortcodes show on the SERPs when Google chooses the description for us -- is there any way to clean this up or prevent it? It's annoying because it includes the entire shortcode, not the markup that gets generated as a result of the shortcode...
On-Page Optimization | | kylesuss0 -
Redirect sub domain to domain in .htaccessU
Hi all, (Total newbie with fourth post of the last 7 days askin' for help!...sorry!) I've discovered that we have a lot of URLs indexed with for example: http://test.betxpert.com/some-odd-url This gives me duplicate content in the search engines. I have searched the web and i can not find a solution fore redirecting http://test.betxpert.com/some-odd-url to http://www.betxpert.com/some-odd-url. Can anyone help me what to write in the .htaccess file? Best regards, Rasmus
On-Page Optimization | | rasmusbang0 -
What's the Best Way to Hide Redirects from Search Engines?
Hey everybody, I like to use php redirects for affiliate links so they look better. I keep them all in the same directory. I read recently that these may hurt SEO. A couple quick questions: Is this the best way to redirect affiliate links? Should I simply block the directory in robots.txt? Any other suggestions from you SEO guyses and galz? Thanks! Jared
On-Page Optimization | | JaredB0 -
Too many 301 redirects to home page - is this possible?
If a site has a bunch of 404’s that are basically old URL’s that no longer work and point to pages or documents that don’t exist anymore - Can someone clarify if it’s a problem when fixing a bunch of these 404’s to point them all to the home page? so if there is not really anywhere else that is applicable for the old broken URL, is it really a problem to 301 old pages to the site home page? I have read some different things on this recently on some different sites, so I just wondered what the latest thinking on this was….thanks...
On-Page Optimization | | inhouseninja0