Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Docs

rewrite rule user dir as subdomain

 

 

Apache docs RSS feed   Index | Next | Previous | View Threaded


jblond at gmail

Nov 5, 2009, 1:58 AM

Post #1 of 3 (87 views)
Permalink
rewrite rule user dir as subdomain

Hi!
I've often been asked how to make userdir as a sudomain.

Maybe that can be as well in the rewrite guide.


cheers
Mario



DocumentRoot /webhosts/

[...]

<VirtualHost *>
ServerAlias www.example.com
ServerName www.example.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ /www/$1 [L]
RewriteCond %{HTTP_HOST} ^www.*
RewriteRule ^(.*)$ /www/$1 [L]
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
RewriteRule ^(.*)$ /%1/$1 [L]
</VirtualHost>

Will be translated to

www.yourdomain.com => /webhosts/www/
muon.yourdomain.com => /webhosts/muon/

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: docs-help[at]httpd.apache.org


mads at toftum

Nov 5, 2009, 2:10 AM

Post #2 of 3 (83 views)
Permalink
Re: rewrite rule user dir as subdomain [In reply to]

On Thu, Nov 05, 2009 at 10:58:17AM +0100, Mario Brandt wrote:
> Hi!
> I've often been asked how to make userdir as a sudomain.
>
> Maybe that can be as well in the rewrite guide.
>
Actually that's one of my common examples of where mod_rewrite is being
used excessively. For the general case, mod_vhost_alias is usually a
much better choice.

vh

Mads Toftum
--
http://soulfood.dk

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: docs-help[at]httpd.apache.org


rbowen at rcbowen

Nov 5, 2009, 7:35 AM

Post #3 of 3 (81 views)
Permalink
Re: rewrite rule user dir as subdomain [In reply to]

There is actually already that example in the rewrite guide. Like many
of the other examples, it is well concealed, and doesn't work very
well. Using mod_rewrite for this causes a number of things to break on
an alarmingly regular basis - most significantly, dynamic thingies
tend to get served as static files all too often.

One of the new main focuses of the rewrite guide is to nudge people
towards solutions that don't use mod_rewrite, such as, in this case,
mod_vhost_alias.

The sheer number of people who are doing virtualhosting at
the .htaccess file level is pretty alarming.



On Nov 5, 2009, at 01:58 , Mario Brandt wrote:

> Hi!
> I've often been asked how to make userdir as a sudomain.
>
> Maybe that can be as well in the rewrite guide.
>
>
> cheers
> Mario
>
>
>
> DocumentRoot /webhosts/
>
> [...]
>
> <VirtualHost *>
> ServerAlias www.example.com
> ServerName www.example.com
> RewriteEngine on
> RewriteCond %{HTTP_HOST} ^example.com
> RewriteRule ^(.*)$ /www/$1 [L]
> RewriteCond %{HTTP_HOST} ^www.*
> RewriteRule ^(.*)$ /www/$1 [L]
> RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
> RewriteRule ^(.*)$ /%1/$1 [L]
> </VirtualHost>
>
> Will be translated to
>
> www.yourdomain.com => /webhosts/www/
> muon.yourdomain.com => /webhosts/muon/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
> For additional commands, e-mail: docs-help[at]httpd.apache.org
>

--
Rich Bowen
rbowen[at]rcbowen.com




---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: docs-help[at]httpd.apache.org

Apache docs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.