Re: mod_rewrite virtual hosting question...

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: alexanderhenry@cox.net
Date:  
To: Main PLUG discussion list
CC: jon
Subject: Re: mod_rewrite virtual hosting question...

---- jon <> wrote:
> I'm totally confused when it comes to mod_rewrite, but here's what I'm
> trying to do -- redirect any instance of a given domain to a specific
> folder.
>
> So.... let's say I want to visit example.com/index.php, the request
> should go to /var/www/sites/example.com/index.php
>
> What I'm looking for is something flexible -- I don't want to have to
> add vhosts everytime we add a domain to the server, just a site.com
> folder in /var/www/sites
>
> Can anyone help... or point the way to good resources?
>
> Thanks....
>
>     -- jon


You need to use virtual hosts. mod_rewrite's first argument accepts a path, second argument accepts a path or URL.


<pre>
--------
RewriteEngine on
RewriteRule    ^(.*)$    http://www.othersite.com$1
--------
</pre>


This takes a request:

http://example.com/index.php

and parses it, so $1='/index.php'.

Then serves http://www.othersite.com/index.php

Where's the string 'example.com'? Nowhere, the regular expression "^(.*)$" sucked in the whole thing. That's all that is available for mod_rewrite to process.

Now quit trying to be lazy with the 5 minutes it takes to make a new vhost, there's a reason why people get paid for this stuff :)
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss