Domain Mapping .htaccess redirect 301


I have a multi-site with domain mapping plug in. We uses sub-domain network set up for mini-sites. We just mapped to

I'm wondering how do we set up redirect 301 in htaccess for old URLs from

For example i want to redirect to

How do i do that in my htaccess file ?


  • Nastia
    • Support Rock Star

    Hello Julie Woempner , I hope you are doing well today!

    If you wish to redirect to another file on your domain please try to use the following code:

    Redirect 301 /oldfile.htm /newfile.htm

    Please keep the original copy of the .htaccess file so is something goes wrong, you can always restore it back.

    I hope this helps!

    Kind Regards,

    • Hendricks Regional Health
      • WPMU DEV Initiate

      Hi Nastia, sorry I don't think I made my question very clear last time. We have a Wordpress multisite with 3 mini sites: (network root site)

      Now we just finish a custom built site on and used the Domain Mapping plugin to map: ->

      There are some older urls being indexed from before we made the Domain Mapping, and now we would like those to be redirected.

      For example:

      older url:

      needs to redirect to:
      new url:

      Yesterday after reading a few online forums, we played with the htaccess for awhile. The tricky part about making these redirects are:

      -Since this is a multisite setup, all of the sites are using a single htaccess file. Therefore, we need to ensure these redirect only works for (aka., because is being domain dapped)

      -These older index urls are query string (

      So for this is what we have for redirects:

      RewriteEngine On
      #RewriteBase /
      RewriteCond %{HTTP_HOST} ^(www\.)?anotherdomain\.com [NC]
      RewriteCond %{QUERY_STRING} id=150 [NC]
      RewriteCond %{QUERY_STRING} sid=5 [NC]
      RewriteCond %{REQUEST_URI} ^/$
      RewriteRule ^$ [R=301,NC,L]

      Do you think you could come up with a better solution? Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.