druplash
asked on
Ho to redirect a domain with htaccess?
Hello,
i have 2 Domains.
www.domain1.com
www.domain2.com
1.) Every Domain haves the same webspace. If somebody type in www.domain2.com he should be redirected to www.domain1.com
2.) If somebody type in domain1.com or domain2.com (without the www.), he also should be redirected to www.domain1.com
Please can somebody explain how to solve this with htaccess on a Linux Server?
Thank´s!
i have 2 Domains.
www.domain1.com
www.domain2.com
1.) Every Domain haves the same webspace. If somebody type in www.domain2.com he should be redirected to www.domain1.com
2.) If somebody type in domain1.com or domain2.com (without the www.), he also should be redirected to www.domain1.com
Please can somebody explain how to solve this with htaccess on a Linux Server?
Thank´s!
ASKER
Thank´s for your reply.
But i have only 1 webspace and 1 htaccess file. Should i write all these rules in 1 htaccess file?
But i have only 1 webspace and 1 htaccess file. Should i write all these rules in 1 htaccess file?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, both are sharing the same directory. And your solution works great!
Many thank´s!!!
Many thank´s!!!
Open in new window
for the .htaccess on domain2
Open in new window