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
-
IMG TITLE no longer used in Wordpress?
Err, when did this happen? Although you can still enter a Title in the WP image library, when inserting into a post the Title tag is not implemented. Alt text is there OK but not Title. There was a plugin around that restored this basic seo functionality but it's no longer available. I mean - honestly!
On-Page Optimization | | robandsarahgillespie0 -
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 -
302 redirections warnings
Hi there, the SEOMOZ crawler has detected some warinings related to the 302 temporary redirections. Example: http://www.tarifakitesurfcamp.com/tks-camp/alojamiento/ redirects to www.tarifakeitesurfcamp.com/error-404 I have made some 301 redirections, located at the end of the final (inicially) and later I just moved them to the top of the file. The htaccess file content is: redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/escuela/ http://www.tarifakitesurfcamp.com/gisela-pulido-escuela/
On-Page Optimization | | juanmiguelcr
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/cursos-kite/ http://www.tarifakitesurfcamp.com/gisela-pulido/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/curso-idiomas/ http://www.tarifakitesurfcamp.com/campamento-bilingue-para-ninos/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/programa-de-actividades/ http://www.tarifakitesurfcamp.com/kitesurf-para-ninos/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/alojamiento/ http://www.tarifakitesurfcamp.com/campamento-de-kitesurf/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/la-empresa-2/ http://www.tarifakitesurfcamp.com/kitesurf-para-ninos-tarifa/ BEGIN ASIGNACIÓN DE TIEMPO DE CACHÉ A IMÁGNES, ARCHIVOS JSS, CSS <ifmodule mod_expires.c="">#activa la generacion de cabecera Expires
ExpiresActive On
#establece el tiempo de cache por defecto
ExpiresDefault A604800
<filesmatch ".(jpg|gif|png|css|ico|js)$"="">#suma 1 dia a la hora de acceso del usuario ExpiresDefault "access plus 7 day"</filesmatch></ifmodule> END ASIGNACIÓN DE TIEMPO DE CACHÉ A IMÁGNES, ARCHIVOS JSS, CSS BEGIN W3TC Browser Cache <ifmodule mod_deflate.c=""><ifmodule mod_headers.c="">Header append Vary User-Agent env=!dont-vary</ifmodule>
AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
<ifmodule mod_mime.c=""># DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml</ifmodule></ifmodule> END W3TC Browser Cache BEGIN W3TC Page Cache core <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{REQUEST_URI} /$
RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index.html%{ENV:W3TC_ENC}" -f
RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index.html%{ENV:W3TC_ENC}" [L]</ifmodule> END W3TC Page Cache core BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule> END WordPress What's wrong? What could happen is I maintain these 302 redirections? Thanks!0 -
301 redirects, efficiency and dynamic URLs
Hi, I have 2 301 redirect questions. Question 1: I have am working with a designer on the redesign of a website that currently has over 5,000 indexed pages. The majority of these are dynamic URLs from the Stone Locator database. (see below) http://www.domain.com/storelocator.php?zipcode=91784&page=12 How can I efficiently deal with these pages from an SEO perspective when developing the new site? Is there a way to do a bulk 301 redirect to a store locator page, for instance? Question 2: If a rel=canonical tag has been established on a page (www....), is it necessary to add 301 redirects to all of the other versions on: the home page (domain.com , domain.com/index.html, domain.com/index.html, etc.) all other pages with those same extensions ? Thank you for your help! Erin
On-Page Optimization | | HiddenPeak0 -
Help: my WordPress Blog generates too many onpage links and duplicate content
I have a WordPress Blog since November last year (so I'm pretty new to WordPress) and the effects on ranking for some keywords are really good. So I thought tag clouds are good. Crawl Diagnostics tell me now that I have too many onpage links for example my author page breaks the record: 256
On-Page Optimization | | inlinear
http://inlinear.com/blog/author/inlinear/ I think thats because there are links for each word in the tag cloud generated ... On this page (and many other pages) WordPress displays (teasers) the beginning of each post (read more ...) producing duplicate content and even new canonical tags.... The page titles are also too long because I installed "All in One SEO Pack" and now this plugin and wordpress itself mixes titles together ... But what can I do to avoid all this. Is there a PlugIn that can help... I think millions of blogs will have the same problems... I my blog yet has very few content. Thanks for your answers :))0 -
How Should I Fix Duplicate Content in Wordpress Pages
In GWMT i see google found 41 duplicate content in my wordpress blog. I am using Yoast SEO plugin to avoid those type of duplicates but still the problem was stick.. You can check the screenshot here - http://prntscr.com/dxfjq Please help..
On-Page Optimization | | mamuti0 -
In my report of my website it was indicated that I had 19 links/locations blocked by meta-robots. What does this mean and how do I fix it. My website is a Wordpress website.
In my report of my website it was indicated that I had 19 links/locations blocked by meta-robots. What does this mean and how do I fix it. My website is a Wordpress website.
On-Page Optimization | | cyaindc0 -
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