.htaccess problem with redirecting 1 domain in a Multisite

I'm trying to come up with the correct .htaccess syntax to create re-write rules for different domains in a multisite using sub-domains. Every rewrite rule I try to create effects all sub-domains. For example- If I try to redirect domain4.com/events to domain3.com/home, If domain5.com has an events page it is also redirected to domain3.com/home or in some cases it returns a 404. I've not been able to create a redirect in my cPanel that works either. Can someone suggest the right rules that would effect the redirection of a URL in only 1 domain or maybe some other method to achieve the same results . The ideal scenario would be to redirect any URL in domain4.com to the home page of domain3.com.

Thanks,
Larry

  • Tyler Postle
    • CGO

    Hey there Larry,

    Hope you're doing well today!

    Do you have the domains added as parked domains in your cPanel? Then you should be able to just go there and enter in the redirect as seen in my screenshot :slight_smile:

    Or you can try adding this to your .htaccess:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^OLDDOMAIN\.com$ [NC]
    RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L]

    Replacing the OLDDOMAIN and NEWDOMAIN placeholders.

    See if either of those solutions do the trick for ya :slight_smile:

    Enjoy the rest of your weekend and let us know if you need further assistance.

    All the best,
    Tyler

  • lbartley
    • The Incredible Code Injector

    Thanks Tyler- That seems to work fine. Another question just to clarify-

    When doing the same thing with a second or third domain would I need to use all five lines of this code or just copy the bottom 2 lines below this and keep going?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.