• I’m about to move my current website (e.g. old.com) to a new domain (e.g. new.com), so I need to have a 301 permanent redirect from one side to the other without messing the remaining network blogs, and maybe excluding a few exceptions, such as /wp-admin and friends.

    Using Redirect 301 / https://new.com/ will redirect all pages, including all blogs in the network and their /wp-* stuff. My guess is to use a .htaccess rewrite rule like the following:

    RewriteEngine on
    RewriteBase /
    RewriteRule (.*) https://www.new.com/$1 [R=301,L]
    

    But wouldn’t this redirect everything as well? Here’s how my current .htaccess looks like, in case it helps. Also, all posts have the same permalinks across both old.com and new.com (e.g. old.com/banksy -> new.com/banksy).

    How can I apply a 301 redirect just to my network main blog and still be able to access old.com/wp-admin and all remaining network blogs?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    How are you moving the site?

    Usually when people do this, it’s moving EVERYTHING on old.com to new.com.

    Thread Starter joaoramos

    (@joaoramos)

    I’ve literally created a new WordPress setup and used the exporter/importer tool to download all data to the new install. Right now I have everything ready except the domain mapping (which is basically resetting symlinks) and the 301 redirect.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Huh. And you’re using subfolders. That’s harder :/

    Well for one you can do this:

    RewriteRule ^blog/(.*) https://www.new.com/$1 [R=301,L]

    All your posts were prefaced by ‘blog’ so that will move them over.

    But the main page abd sub pages, you may be better off redirecting each manually:

    RewriteRule ^blog/(.*) https://www.new.com/$1 [R=301,L]
    RedirectMatch 301 /(about|page2|page3)?$ https://www.new.com/$1

    I think… The second line I’m not 100% sure on.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to apply 301 redirect just to network's main blog?’ is closed to new replies.