htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Virtual User Hosts [using HTTP_HOST header]
PostPosted: 30 Oct 2006 20:40 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
Description:

Assume that you want to provide http://www.username.host.domain.com for the homepage of username via just DNS A records to the same machine and without any virtualhosts on this machine.

Solution:

For HTTP/1.0 requests there is no solution, but for HTTP/1.1 requests which contain a Host: HTTP header we can use the following ruleset to rewrite http://www.username.host.com/anypath internally to /home/username/anypath:

Code:
RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^www\.[^.]+\.host\.com$
RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
RewriteRule   ^www\.([^.]+)\.host\.com(.*) /home/$1$2


Top
 Profile  
 
 Post subject: I have a similar issue
PostPosted: 30 Jan 2007 02:28 
Offline

Joined: 30 Jan 2007 02:13
Posts: 1
Hi,

I have a similar issue I've just spent about 4 hours trying to figure out and haven't got anywhere (although i did screw the server a couple of times)

Basically i have two tlds that point to my www directory, and I want to seamlessly divide them into separate directories so they function as separate sites.

So I have

Code:
WWW
  |___ siteDirOne
  |
  |___ siteDirTwo



And two domains domainOne.com and domainTwo.com, which both point to WWW.

How can I quietly redirect all request from one domain to one folder and the other domain to the other folder - including getting subdirectories of those domains/folders to match up and work correctly too.

So to summarise - using nothing but .htaccess I want to make my set up look like two separate sites.

Thanks, I hope someone knows how to help.

:)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: MSNbot Media and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB