Support » Networking WordPress » slightly complicated 301 redirect issue

  • Resolved Sallie Goetsch


    I have a client whose site runs on Server X, managed by their IT department. I believe Server X is a Windows Server, but I don’t know for sure.

    The WordPress Multi-site installation we’re managing is on a Linux server (Server Y) hosted someplace else entirely and the specific sub-site we have the issue with is mapped to

    The client used to have two pages for their PR stuff,


    Now they have

    Media Information

    “Oh,” I said brightly, not realizing what a TREMENDOUS pain this is with Multi-site, “We’ll just set up some 301 redirects in your .htaccess file.”

    Well, I haven’t been able to figure out how to do that. Read a few things here in the forums and elsewhere online, but nothing worked. I suspect that having the main domain actually on a different DNS doesn’t help at all, but don’t know enough about it to be sure.

    In any case I don’t need regex or anything fancy, just for those two URLs to point to that one new page.

    Can anyone here help? I am reluctant to install plugins because there’s a lot of custom code on this site and I’d rather keep potential conflicts to a minimum, but I’m willing to try anything with a good chance of working.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You want both the old pages to point to the new ones? That is pretty easy, even with Multisite 🙂

    Rule 1) Always put your 301s and other customizations above the WordPress htaccess calls.

    Rule 2) KISS 😉

    Redirect 301 /media-policy-and-procedures/
    Redirect 301 /media-contact/

    If you want to get a little fancier…

    RewriteRule ^media-policy-and-procedures(.*)$ [L,R=301]
    RewriteRule ^media-contact(.*)$ [L,R=301]

    That should cover trailing slash or not. The only reason that would be problematic is if you have those pages on other sites as well.

    I took over this project two years in, and there are 6 sites, so I’ll have to go see whether those pages exist on the other sites. (Oh, someone PLEASE invent a way for the network admin to log into all the dashboards at once. PLEASE.)

    Ah. Small snag. Five of the six sites have /media-info/ pages. I don’t know whether they also had older pages that need redirecting, though. The client has not mentioned any. (As the client is not known for rigorous testing, this means nothing.)

    So maybe we DO need a regex?

    Okay, I checked with the client. The old pages don’t exist on the other sites, so your solution will work. And it DOES work. You, @ipstenu, are a genius. I was going to make a donation for the brilliant Multi-site e-book you and @andrea_r wrote anyway, but will run over and do it now.

    Glad it worked! You can still redirect if it’s on multiple sites by prefacing each rewrite with this:

    RewriteCond %{HTTP_HOST} ^newsroom\.altabatessummi\

    Sadly I’ve never been able to make it work right as a section, so I ended up with a slew of ‘Rewrite cond’ followed by the rule, over and over :/ I’m sure there’s a better way!

    (Oh, someone PLEASE invent a way for the network admin to log into all the dashboards at once. PLEASE.)

    The ‘problem’ is browsers and cookies. Subdomains are ‘kind of’ separate domains so the cookies are, for your safety, not allowed to cross domains. You can be logged in to all at once, but the cookies/login may expire :/

    Does anyone actually have this working under the following scenario:

    1. Old standalone sites migrated to a multisite network
    2. Old sites have pages with same name so need to distinguish between domains on the new networked sites
    3. New page names are different from old page names..
    4. I have roughtly a dozen of these for each domain .. so already need hundreds…

    Old pages:

    New networked pages:

    I have tried matching http host with a rewrite condition to no avail. The only way I’ve been successful is a vanilla:

    Redirect 301 oldpage.html

    … but that doesn’t cut it because the old pages have the same name on all the old sites. I’ve tried several redirect plugins as well.

    I’ve love to the see the .htaccess file of a fully working site that has the same scenario!!



    I have finally resolved this one .. if anyone is in similar situation, please contact me. Part of the problem appears to have been in the order of instuctions in the WP multisite .htaccess file and which lines had the [L} directive

    Basically, the working format is:

    RewriteCond %{HTTP_HOST} ^ [OR]
    RewriteCond %{HTTP_HOST} ^
    RewriteRule page.html$ [R=301,NC,L]
    RewriteRule pg2.html$ [R=301,NC,L]

    I did note elsewhere that someone had found they need to repeat the RewriteCond statement before each rule, but I have now got the first 6 domains done using only the pair of conditions for www vs non www and then just the rules (about a dozen per domain) for each page where I needed to do the redirection.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘slightly complicated 301 redirect issue’ is closed to new replies.