virtual hosts for users

Apr 27, 2010 at 2:27 PM

hi, i want to give users virtual directories as per the example here.

this is what i have

RewriteCond %{HTTP_HOST} ^(?!www)([^.]+)\.alpha.mysite\.com [I]
RewriteRule ^/(.*)      /userwebs/*1/$1                 [L]

is it correct? do i need to substitute something else?

what needs to change in the dns a records

Coordinator
Apr 27, 2010 at 4:29 PM
Edited Apr 27, 2010 at 4:36 PM

I won't advise you on the DNS A records, because I don't know about that stuff.  I think all you need is a wildcard A record, but I'm no expert.

Your rule looks fine to me.  You will want to escape the dot after alpha in your RewriteCond.  Use \.alpha\.mysite\.com instead of \.alpha.mysite\.com .

 

Apr 27, 2010 at 4:41 PM
Cheeso wrote:

I won't advise you on the DNS A records, because I don't know about that stuff.  I think all you need is a wildcard A record, but I'm no expert.

Your rule looks fine to me.  You will want to escape the dot after alpha in your RewriteCond.  Use \.alpha\.mysite\.com instead of \.alpha.mysite\.com .

 

tnx for the reply, i'm trying that now, with regards to the DNS A records will it this work without it cos i'm loath to mess with DNS records for fear of messing it all up..

 

Coordinator
Apr 27, 2010 at 4:51 PM

As I said, I'm not a DNS expert, but I think you need the wildcard A record in order to allow requests for (for example) http://carlos.alpha.mysite.com to resolve to your IIS Server.

 

Apr 27, 2010 at 8:01 PM
Edited Apr 27, 2010 at 8:02 PM
Cheeso wrote:

As I said, I'm not a DNS expert, but I think you need the wildcard A record in order to allow requests for (for example) http://carlos.alpha.mysite.com to resolve to your IIS Server.

 

ok i'm still confused!

I've added a DNS A record but still no joy. would you mind clarifying what the rule is meant to be doing?

UPDATE:

requests are all forwarded to http://mysite.com

 

Coordinator
Apr 27, 2010 at 10:21 PM

Ah, a basic, foundational question.
In that case, I suggest you read up on IIRF.

The documentation is available online.

In the section on RewriteRule, you'll find a clear description of what that rule does, with lots of examples.