How to write 301 redirects in WordPress
-
I've successfully migrated new site to new domain (www.cmsearchmarketing.com)
But I cannot get 301 redirects for pages and blog posts to redirect from the old domain (www.creativemindsearchmarketing.com).
And it's my understanding I need to do a 301 for each page to maintain SEO.
Here's what I've tried:
RewriteCond %{QUERY_STRING} ^p=975$RewriteRule ^index.php$ http://www.cmsearchmarketing.com/top-5-questions-to-ask-an-seo-firm-before-signing-up/? [R=301,L]
BEGIN WordPress<ifmodule mod_rewrite.c="">RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</ifmodule># END WordPress
#AND ALSO#
Use PHP5 Single php.ini as defaultAddHandler application/x-httpd-php5s .php
BEGIN WordPress<ifmodule mod_rewrite.c="">RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</ifmodule># END WordPress
redirect 301 /top-5-questions-to-ask-an-seo-firm-before-signing-up http://www.cmsearchmarketing.com/top-5-questions-to-ask-an-seo-firm-before-signing-up/
Any suggestions would be appreciated.
_Cindy
P.S. Maybe some other issues are in the way:
--Old site is WP-Remix theme no longer supported, and latest WP version is 2.9.1
-- Old domain (www.creativemindsearchmarketing.com) is the primary account on BlueHost …and the new domain (www.cmsearchmarketing.com) is an addon, so the new domain's directory is within root of old domain.
-- in root domain of old site there are other "handler files" that also have base file rewrites, if this is an issue:
name of this file in root directory is:
.htaccess.addHandlerBak-FrontPage-
<limit get="" post="">order deny,allowdeny from allallow from all</limit><limit put="" delete="">order deny,allowdeny from all</limit>AuthUserFile /home/creatjo7/public_html/_vti_pvt/service.pwdAuthGroupFile /home/creatjo7/public_html/_vti_pvt/service.grp# BEGIN WordPress<ifmodule mod_rewrite.c="">RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</ifmodule>
END WordPressAuthName creativemindsearchmarketing.comIndexIgnore .htaccess /.?? *~ *# /HEADER /README /_vti
-
OK, so simple 301 redirects seem to be working out fine.
But having a thing for a puzzle, and thus far learning more about htaccess, I am wondering why a simple rewrite... or "redirect" rule would not work. Like this:
RewriteRule ^(./blog)$ http://cmsearchmarketing.com/blog$1.php [R=301,NC]
or this
RewriteRule ^./blog$ http://www.cmsearchmarketing.com/blog [R=301,NC]
(...and this goes into the old site htaccess with the old domain name, NOT the new site with the new domain name; and the new site basically has all new page names.)
Where in the htaccess file would it go... after the WP permalink rule - considering I am using permalinks on the site and writing the rules with the permalink structure?
Can I write a rule such as this and redirect to another domain all together?
When would I use [L] for last rule?
And what's the difference in a rewrite and a redirect?
OK, if anyone is pursuing and can help I would appreciate.
Thank you very much._Cindy
-
Sorry, try that link again (I've edited it)
-
Didn't understand the link you gave...
-
Hi Cindy,
You can install the plugin on your current setup, and it should work, if by chance it doesnt work, you can download the older versions here which are supported in 2.9.1
This plugin allows you to 301 redirect from anywhere on your site to any external link you want
-
You should be able to do something like this: http://screencast.com/t/1kU7rKwiC
-
So is the redirection plugin installed on the old site (that's a different domain name), and can the target url be an external link?
The source URL cannot be an external link, right?
Cindy
-
Thank you for answering.
None of the pages are the same name on new site as on the old site.
However, the blog posts are the same. And if i could use a redirect for all pages on blog that would help.
But when I use the cpanel wildcard, or rules to the htaccess file, I do not get one page corresponding to the new page, - all old blog posts go to the home page.
_Cindy
-
Cindy as long as your categories and file names are the same, you can just put in 1 (one) wild card redirect that will redirect everything from your old domain to the same file name on your new domain. i.e. olddomain.com/seo/goodseo.html will redirect to newdomian.com/se/goodseo
And, the easiest way to do this is from your servers Cpanel. Go into the cpanel, look for redirect, tell it the old domain and the new domain and tell it to use "wild card" for redirection.
-
Thanks for your reply.
The old site theme isn't supported anymore, cannot update WP beyond 2.9.1.
Does this simple 301 redirect plugin need to be on old site or new?
So if old domain name is different than new domain name, can I use this plugin?
_Cindy
-
I recommend Redirection – it's the most popular plugin out there. I use it on a number of sites and works great.
-
Is the old site in WordPress? Try Simple 301 Redirects or a similar plugin to 301 individual pages/posts.
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 from sites closing down
Hi We have around 10 supplementary sites that have links to our site which are now closing down but are out of our control. We could have access to their domains so how could we maintain the link juice from these old sites which are going to our new site? However there will be no websites left on these old supplementary just domain names
Technical SEO | | ocelot0 -
301 Redirect - Technical Question
I have recently updated a site and for the url's that had changed or were not transferring I set up 301 redirects in the htaccess file as follows This one works - Redirect 301 /industry-sectors http://www.tornadowire.co.uk/fencing But this one doesn't - Redirect 301 /industry-sectors/equine http://www.tornadowire.co.uk/fencing/application/equestrian/ What it does is change the url to this instead http://www.tornadowire.co.uk/fencing/equine ..... which returns a 404 page not found error The server is nginx based server and we have moved from a joomal platform to a wordpress platform I would be grateful for any ideas
Technical SEO | | paulie650 -
Is 301 redirecting all old URLS after a new site redesign to the root domain bad for SEO?
After a new site redesign ...would it hinder our rankings if we 301 redirected all old URLS that are returning 404 error codes to the root domain (home page) ? Would this be a good temporary solution until we are able to redirect the pages to the appropriate corresponding page? Thanks so much!
Technical SEO | | DCochrane0 -
Need Help writing 301 redirects in .htaccess file
SEOmoz tool shows me 2 errors for duplicate content pages (www.abc.com and www.abc.com/index.html). I believe, the solution to this is writing 301 redirects I need two 301 redirects 1. abc.com to www.abc.com 2. /index.html to / (which is www.abc.com/index.html to www.abc.com) The code that I currently have is ................................................... RewriteEngine On
Technical SEO | | WebsiteEditor
RewriteCond %{HTTP_HOST} ^abc.com
RewriteRule (.*) http://www.abc.com/$1 [R=301,L] Redirect 301 http://www.abc.com/index.html http://www.abc.com ...................................................... but this does not redirect /index.html to abc.com. What is wrong here? Please help.0 -
How to create a delayed 301 redirect that still passes juice?
My company is merging one of our sites into another site. At first I was just going to create a 301 redirect from domainA.com to domainB.com but we decided that would be too confusing for customers expecting to see domainA.com so we want to create a page that says something like "We've moved. please visit domainB.com or be redirected after 10 seconds". My question is, how do I create a redirect that has a delay and will this still pass the same amount of juice that a regular 301 redirect would? I've heard that meta refreshes are considered spammy by Google.
Technical SEO | | bewoldt0 -
Is Buying Domains Good For SEO? Can I 301 redirect domains to an Original website?
I have a friend that purchased multiple domains related to their website. Each of these domains have the back ground of the original website and irrelevant content on them. Is is possible to redirect the various domains to certain pages on the original website. For example if the website is www.shoes.com and they purchased domains such as www.leathermensshoes.com and a few others related to the website. Is it SEO friendly to link the domains purchased to the original website?
Technical SEO | | TSpike10 -
301 Redirect Properly To Keep the Juice
I have a bunch of WP Blogs and was thinking of taking all linkjuice from these to my main money site. The most of the other WP Blogs is hosted at godaddy.com (domain and site) and I know they have a URL Redirects page in site manager but I`m not sure this is the right way to go. Also I wonder some of these sites have hundreds of blogposts there is no way I can "re-create" those on the money site but I am sure that is not a must-thing to do in order to keep the "juice" right or wrong? Last but not least, I was wondering if you think it would be best to redirect the sites to relevant pages on money sites. For instance if i had a domain called cheap-ties.com with 100 blogposts about this and on money site a webshop with a category called ties, should redirect to this or to main domain or doesnt it matter?
Technical SEO | | fAgBxa8b0 -
301 Redirects
Hello, I have a problem with my website. I have a page on my website http://www.ensorbuilding.com/page.php/aboutus but if i type in www.ensorbuilding.com/page.php/aboutus/f8e45e9d9df6140bb5a7ff1173e8d828 or www.ensorbuilding.com/page.php/aboutus/0f0eea5e9ab0a3e8d91fad8fc0d3ce9c it still displays the about us page. Google is seeing this as duplicate content so what I would want to do is 301 redirect anything after www.ensorbuilding.com/page.php/aboutus . How could I implement a 301 redirect in this way?
Technical SEO | | danielmckay70