Url rewriting

how to redirect http://mail.mydomain.com
to http://www.otherdomain.com/othermail

many thanks
LVL 8
us111Asked:
Who is Participating?
 
caterham_wwwConnect With a Mentor Commented:
ok. So you must check the Host. That can be done with a condition.

RewriteCond %{HTTP_HOST} =mail.mydomain.com
RewriteRule ^(.*) http://www.otherdomain.com/othermail/$1 [R=301,L]

that will issue a redirect if the user comes from mail.mydomain.com.
0
 
caterham_wwwCommented:
it depends...

If http://mail.mydomain.com is a separate account, you could use in a .htaccess file (if you don't have access to the configuration files)

Redirect 301 / http://www.otherdomain.com/othermail/

But if both domains are pointing to the same location, you must use mod_rewrite to check the HTTP_HOST.
0
 
us111Author Commented:
To be more precised, this is the same server and mod_rewrite is require for this purpose but how....
0
 
us111Author Commented:
ok gonna try tonight
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.