Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite'ing for 'virtual hosts'?

Status
Not open for further replies.

jsquared

MIS
Jan 13, 2004
1
US
Hi. My file structure is set up as such:

/usr/home/mysite.com/htdocs is where the root of my web documents are.

Additionally, I have:

/usr/home/mysite.com/projects/
/usr/home/mysite.com/images/
/usr/home/mysite.com/junk/


and so on.

I would like to create a rewrite rule which specifies that any request for:

mysite.com/{rest_of_path}
or
www.mysite.com/{rest_of_path}

is mapped to

/usr/home/mysite.com/htdocs/{rest_of_path}

However, anything else, e.g.

{subdomain}.mysite.com/{rest_of_path}

is mapped to

/usr/home/mysite.com/{subdomain}/{rest_of_path}

In other words, if {subdomain} == 'www' or isn't specified, look in mysite.com/htdocs. Otherwise, look in mysite.com/{subdomain}.

Any help would be greatly appreciated. I'm having trouble with the conditional portion of the rule. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top