from host.domain.com to host.domain.com/sub/dir

Using a single web hosting account to host multiple sites

from host.domain.com to host.domain.com/sub/dir

Postby Ianb » Mon Jun 08, 2009 9:22 pm

Sound simple ?

Multiple CNames to a single IP address / host

Want to redirect ONE of the cnames (in both short and FQDN forms) and append a subdir to it, whilst not affecting the other cnames.

EXAMPLE:
http://webmail or http://webmail.domain.com should redirect to http://webmail.domain.com/sub/dir

but

http://anything_else.domain.com should remain untouched
http://ip_address should remain untouched

I have found several examples to do parts of this but lack the understanding to combine them (or devise something shorter).

Ideas ?

TIA,

Ian
Ianb
 
Posts: 1
Joined: Mon Jun 08, 2009 9:08 pm

Postby richardk » Tue Jun 09, 2009 3:19 pm

Match the HTTP_HOST
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^webmail(\.example\.com)?$ [NC]
RewriteRule ^$ http://webmail.example.com/sub/dir/ [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 19 guests

cron