Mobile app version of vmapp.org
Login or Join
Vandalay111

: .htaccess mod_rewrite domain to subdomain I need to redirect any domain to a sub-domain. I know this has got to be possible but for the life of me i can not figure it out. Any help is appreciated.

@Vandalay111

Posted in: #Htaccess #ModRewrite #Subdomain

I need to redirect any domain to a sub-domain. I know this has got to be possible but for the life of me i can not figure it out. Any help is appreciated.

For example:

domain1.com
domain2.com
subdomain1.domain1.com
subdomain2.domain2.com

all go to subdomain3.domain.com

but i need code that does not require me to enter each domain i want redirected. So for any feature domains that i link or create will go to subdomain3.domain.com btw this will only happen when viewing anydomain.com/path <-- the path is a sym link

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay111

1 Comments

Sorted by latest first Latest Oldest Best

 

@Fox8124981

I’m not sure if I understand your question right. If you want to redirect all requests to path to subdomain3.example.com just compare the hosts:

RewriteCond %{HTTP_HOST} !^subdomain3.example.com$
RewriteRule ^path subdomain3.example.com/ [L,R=301]


Update

RewriteCond %{HTTP_HOST} !^subdomain3.example.com$
# At least one character after /
RewriteRule (.+) subdomain3.example.com/ [L,R=301]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme