mod_vhost_alias or mod_rewrite help needed.

mod_vhost_alias or mod_rewrite help needed.

Post by Fredrik Ste » Sun, 24 Mar 2002 00:58:38



Hi,

Example virtualhost
<VirtualHost 10.180.68.64>
  ServerName www.domain.com
  ServerAlias domain.com
  ServerAlias www.anotherdomain.com
  DocumentRoot /home/users/corgrjar
  ScriptAlias /cgi-bin/ /home/users/corgrjar/cgi-bin/
  User corgrjar
  Group webusers
</VirtualHost>

I want to use mod_vhost and or mod_rewrite to change directory
layout and to minimize the memory usage/startup time of apache and to
have a nicer diretory structure.

This is how far I have come:
<VirtualHost 10.180.68.64>
       ServerName www.domain.com
       CustomLog logs/access_log.mvhost vcommon
       VirtualDocumentRoot /virtualhosts/%2.1/%0/
       VirtualScriptAlias  /virtualhosts/%2.1/%0/cgi-bin
</VirtualHost>

The DocumentRoot would be: /virtualhosts/d/www.domain.com/
But then I have this problem with ServerAliases. I could
make a symlink for www.anotherdomain.com in
/virtualhosts/a/www.anotherdomain.com -> ../d/www.domain.com/
But that would be _alot_ of symlinks.

So my question is if you could have a file with the ServerAliases
assosiated with the path or similar and rewrite it to the
ServerName directory. And to make it even more complex a domain
(ServerName) can have more than one ServerAlias assosiated with it.

Has anyone done this? Is it possible?

Greetings from Sweden.
./fs

 
 
 

mod_vhost_alias or mod_rewrite help needed.

Post by Jorey Bum » Wed, 27 Mar 2002 07:00:09



> Hi,

> Example virtualhost
> <VirtualHost 10.180.68.64>
>   ServerName www.domain.com
>   ServerAlias domain.com
>   ServerAlias www.anotherdomain.com
>   DocumentRoot /home/users/corgrjar
>   ScriptAlias /cgi-bin/ /home/users/corgrjar/cgi-bin/
>   User corgrjar
>   Group webusers
> </VirtualHost>

> I want to use mod_vhost and or mod_rewrite to change directory
> layout and to minimize the memory usage/startup time of apache and to
> have a nicer diretory structure.

> This is how far I have come:
> <VirtualHost 10.180.68.64>
>        ServerName www.domain.com
>        CustomLog logs/access_log.mvhost vcommon
>        VirtualDocumentRoot /virtualhosts/%2.1/%0/
>        VirtualScriptAlias  /virtualhosts/%2.1/%0/cgi-bin
> </VirtualHost>

> The DocumentRoot would be: /virtualhosts/d/www.domain.com/
> But then I have this problem with ServerAliases. I could
> make a symlink for www.anotherdomain.com in
> /virtualhosts/a/www.anotherdomain.com -> ../d/www.domain.com/
> But that would be _alot_ of symlinks.

> So my question is if you could have a file with the ServerAliases
> assosiated with the path or similar and rewrite it to the
> ServerName directory. And to make it even more complex a domain
> (ServerName) can have more than one ServerAlias assosiated with it.

> Has anyone done this? Is it possible?

Don't use ServerName or ServerAlias with mass virtual hosting. Also,
some other directives don't work, such as Alias. It's a powerful way to
accommodate lots of hosts dynamically, but it is not as flexible. If you
need to restore some of that lost functionality to a domain, put its
VirtualHost section before the one used for mass virtual hosting.

 
 
 

1. Need help with mod_vhost_alias and existing mod_rewrite rules

Hi,

I host approx 200+ virtual domains on one of my
servers using apache 1.3.11 and mod_vhost_alias.
I've recently switched to using mod_vhost_alias
to lower the memory usage of apache's httpd. So
far its been successful, I've lowered the mem
usage by approx %45. Now the problem is, each of
these domains used to have mod_rewrite rules
which allowed itself, and a list of other trusted
domains, access to a specific area of the domain.

Heres an example of the rules:

RewriteCond %{HTTP_REFERER}
^http://www.DOMAIN_NAME.com/* [OR]
RewriteCond %{HTTP_REFERER}
^http://DOMAIN_NAME.com/* [OR]
RewriteCond %{HTTP_REFERER}
^http://www.TRUSTED_HTTP_REFERER.com*
RewriteRule ^/(.*) - [L]
RewriteRule RESTRICTED_AREA - [F,L]
RewriteRule /(.*).htm[l]?$ - [L]
RewriteRule /$ - [L]
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME}/ -d
RewriteRule ^/(.*) - [L]
RewriteRule ^/(.*) - [F,L]

these work fine when I'm using individual
VirtualHost configs in my httpd.conf, but with
mod_vhost_alias I dont seem to have that ability
anymore. Heres what I have in my httpd.conf to
server all my 200+ virtual domains:

UseCanonicalName Off
VirtualDocumentRoot /Sites/www/%0/htdocs
VirtualScriptAlias  /Sites/www/%0/cgi-bin

Is there a way to implement a generic mod_rewrite
rule that I can apply to all of my domains, and
still keep my httpd.conf from using individual
VirtualHosts?

Thanks for your time, I'd really appreciate any
pointers and guidance.

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Linux suxxxx

3. MOD_Rewrite Help Needed....

4. ppp echo packets

5. Need a mod_rewrite whiz to help with this..please!

6. Buying hardware from other countries

7. Newbie needs help with a simple Mod_Rewrite

8. PATH var initialization

9. Need help: Perplexing problem with mod_rewrite in Apache 1.2.4

10. mod_rewrite help urgently needed

11. Need help with strange mod_rewrite behavour

12. Need help in mod_rewrite

13. Need help ... mod_rewrite?