The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. How to write 301 redirects in WordPress

    How to write 301 redirects in WordPress

    Technical SEO Issues
    12 4 2.4k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • CeCeBar
      CeCeBar last edited by

      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

      1 Reply Last reply Reply Quote 0
      • CaseyKluver
        CaseyKluver last edited by

        Is the old site in WordPress? Try Simple 301 Redirects or a similar plugin to 301 individual pages/posts.

        CeCeBar 1 Reply Last reply Reply Quote 1
        • Georgios
          Georgios last edited by

          I recommend Redirection – it's the most popular plugin out there. I use it on a number of sites and works great.

          CeCeBar 1 Reply Last reply Reply Quote 0
          • CeCeBar
            CeCeBar @CaseyKluver last edited by

            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

            CaseyKluver 1 Reply Last reply Reply Quote 0
            • Brian-M
              Brian-M last edited by

              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.

              CeCeBar 1 Reply Last reply Reply Quote 0
              • CeCeBar
                CeCeBar @Brian-M last edited by

                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

                Brian-M CeCeBar 3 Replies Last reply Reply Quote 0
                • CeCeBar
                  CeCeBar @Georgios last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • Brian-M
                    Brian-M @CeCeBar last edited by

                    You should be able to do something like this: http://screencast.com/t/1kU7rKwiC

                    1 Reply Last reply Reply Quote 0
                    • CaseyKluver
                      CaseyKluver @CeCeBar last edited by

                      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 🙂

                      1 Reply Last reply Reply Quote 0
                      • CeCeBar
                        CeCeBar @CeCeBar last edited by

                        Didn't understand the link you gave...

                        1 Reply Last reply Reply Quote 0
                        • Brian-M
                          Brian-M @CeCeBar last edited by

                          Sorry, try that link again (I've edited it)

                          1 Reply Last reply Reply Quote 0
                          • CeCeBar
                            CeCeBar last edited by

                            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

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            • Help Setting Up 301 Redirects from Coldfusion Site to Wordpress Site.
                              MarketHubb
                              MarketHubb
                              1
                              3
                              143

                            • Blogger to Wordpress 301 and Meta Refresher Redirect
                              evolvingSEO
                              evolvingSEO
                              0
                              9
                              434

                            • 301 redirects reverting to 302 redirects
                              Devanur-Rafi
                              Devanur-Rafi
                              0
                              6
                              532

                            • Need Help writing 301 redirects in .htaccess file
                              Dr-Pete
                              Dr-Pete
                              0
                              5
                              1.3k

                            • Where does Wordpress store the 301 redirects?
                              dballari
                              dballari
                              0
                              4
                              6.9k

                            • 301 redirect on wordpress.com
                              Tunji
                              Tunji
                              0
                              3
                              2.8k

                            • 301 Redirect Domain or 301 Redirect Domain + Interior Pages
                              Room214
                              Room214
                              0
                              7
                              1.1k

                            • Wordpress 301 redirects
                              KeriMorgret
                              KeriMorgret
                              0
                              5
                              916

                            Get started with Moz Pro!

                            Unlock the power of advanced SEO tools and data-driven insights.

                            Start my free trial
                            Products
                            • Moz Pro
                            • Moz Local
                            • Moz API
                            • Moz Data
                            • STAT
                            • Product Updates
                            Moz Solutions
                            • SMB Solutions
                            • Agency Solutions
                            • Enterprise Solutions
                            • Digital Marketers
                            Free SEO Tools
                            • Domain Authority Checker
                            • Link Explorer
                            • Keyword Explorer
                            • Competitive Research
                            • Brand Authority Checker
                            • Local Citation Checker
                            • MozBar Extension
                            • MozCast
                            Resources
                            • Blog
                            • SEO Learning Center
                            • Help Hub
                            • Beginner's Guide to SEO
                            • How-to Guides
                            • Moz Academy
                            • API Docs
                            About Moz
                            • About
                            • Team
                            • Careers
                            • Contact
                            Why Moz
                            • Case Studies
                            • Testimonials
                            Get Involved
                            • Become an Affiliate
                            • MozCon
                            • Webinars
                            • Practical Marketer Series
                            • MozPod
                            Connect with us

                            Contact the Help team

                            Join our newsletter
                            Moz logo
                            © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                            • Accessibility
                            • Terms of Use
                            • Privacy