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 -
Will Multiple 301's to the Same URL Cause Issues?
Hey Everyone, We have a client (I don't have permission to disclose) that has just attempted to create better URL's for their site, per our direction. In the process, their website platform kind of took over their renaming attempts and instead of creating the clean, short, descriptive URLs we all wanted, they got convoluted, longer URLs. This all happened within the past 3 or 4 days. So, they went out and got an add-on that's going to help them create better URL's. In the meantime, they now have the original page/URL plus two new ones for a total of three. No 301's have been setup yet. When they create the new and (hopefully) improved URL tomorrow, will it hurt their rankings to have three pages redirected to the new one? Is a 301 redirect the right method for this issue or should they do something different? Thanks in advance, Kirk
On-Page Optimization | | kbates0 -
Thousands of 404's showing up from Wordpress Blog!?!?
Hey guys, Have recently seen thousands of 404 errors thrown up from my wordpress blog in Google Search Console. These are URL's trying to link (i'm not sure where from) to other parts of my site, but they are not relative to the site root... infact they are a mix of random folders/subfolders and pages on my site. E.g: http://www.MYSITE.co.uk/blog/how-to/driving-to-the-alps/attachment/2013-land-rover-range-rover-evoque-front-snow-1/st-martin-de-belleville/chalet-st-martin-de-belleville/ski-holidays/ski-holidays/summer/st-martin-de-belleville/summer/your-stay-st-martin-de-belleville.html This is a link to a picture on the blog: http://www.MYSITE.co.uk/blog/how-to/driving-to-the-alps/attachment/2013-land-rover-range-rover-evoque-front-snow-1/ And the rest of it is finding it's own way there! Any ideas? This is Wordpress by the way. Cheers, Paul. p.s. I got no help from the Wordpress community so am posting here! p.p.s I forgot to mention that MOZ is reporting these issues too, but running Screaming Frog does NOT show any 404's at all on my site...
On-Page Optimization | | SnowTrippin0 -
Htaccess redirect, from /year/month to /blog
I am trying to make some redirects so we don't lose that SEO juice. I am trying to move our blog structure from:
On-Page Optimization | | opiates
http://www.domain.com/2015/09/title-of-blog to:
http://www.domain.com/blog/title-of-blog I need to do redirects in htaccess from the old structure to the new structure but I can't seem to get it working properly. Here is what I have thus far. <code>RewriteEngine on RewriteBase / RewriteRule ^(.0-9)\/^(.0-9)\$ $1/ [R=301,L]</code> Any suggestions?0 -
Redirect www.domain to domain
How do I redirect www.entrepreneurhandbook.co.uk to entrepreneurhandbook.co.uk The latter is an existing site. Thanks James
On-Page Optimization | | entrepreneurhandbook1 -
Temp redirects of homepage URLs
Working on a site for a client and the CMS provider has all variants of their domain (.co.uk & .com and / and http:// etc) temp redirecting to the /default.aspx homepage. I know in theory that this means no Google Juice is being passed to the final location page, does this mean that all backlinks that point to their domain are not actually passing Juice onto the homepage? Thanks
On-Page Optimization | | Switch_Digital0 -
301 redirect results in plummeting DA. Why?
I redirected from my .co.uk site to my .com site (www.salesandinternetmarketing) and my Domain Authority has gone from 44 to 33!? Also SEO Moz states that it's crawled all my pages, yet isn't showing any on page reports, inculding keyword usage, meta descriptions, etc. I'm very confused and not receiving clear answers from the support team (they've said one of the reasons is that my keywords are not ranked in the top 50, well some are, nevertheless I should still be getting some report info shouldn't I)? Can someone please help, I'm rather fed up as this has been going on a for a couple of weeks now
On-Page Optimization | | lindsayjhopkins0 -
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