[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Apache2 & mod_rewrite



Simo Kauppi ha scritto:

Okey, how does this look?

000-domain:

NameVirtualHost xxx.xxx.xxx.xxx
<VirtualHost xxx.xxx.xxx.xxx>
	ServerAdmin webmaster@domain.com
	ServerName www.domain.com
	ServerAlias *.domain.com domain.com
	RewriteEngine On
	RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
	RewriteCond %{HTTP_HOST} !^$
	RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
	
	DocumentRoot /var/www/
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined
	ServerSignature On
</VirtualHost>

001-domain1:

<VirtualHost xxx.xxx.xxx.xxx>
	ServerAdmin webmaster@domain1.com
	ServerName www.domain1.com
	ServerAlias pop.domain1.com smtp.domain1.com domain1.com
	RewriteEngine On
	RewriteCond %{HTTP_HOST} !^www\.domain1\.com [NC]
	RewriteCond %{HTTP_HOST} !^$
	RewriteRule ^/(.*) http://www.domain1.com/$1 [L,R]
	
	DocumentRoot /var/www/domain1
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/domain1>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order deny,allow
		Allow from all
	</Directory>

	ErrorLog /var/log/apache2/domain1-error.log

	LogLevel warn

	CustomLog /var/log/apache2/domain1-access.log combined
	ServerSignature On
</VirtualHost>

002-domain2:

<VirtualHost xxx.xxx.xxx.xxx>
	ServerAdmin webmaster@domain2.com
	ServerName www.domain2.com
	ServerAlias pop.domain2.com smtp.domain2.com domain2.com
	RewriteEngine On
	RewriteCond %{HTTP_HOST} !^www\.domain2\.com [NC]
	RewriteCond %{HTTP_HOST} !^$
	RewriteRule ^/(.*) http://www.domain2.com/$1 [L,R]
	
	DocumentRoot /var/www/domain2
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/domain2>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order deny,allow
		Allow from all
	</Directory>

	ErrorLog /var/log/apache2/domain2-error.log

	LogLevel warn

	CustomLog /var/log/apache2/domain2-access.log combined
	ServerSignature On
</VirtualHost>

Simo
OK. Apache2 works perfectly now. Thanks :-)

I have also an other question to the rewrite module and Apache2. I have configurated a virtual host with ssl. I would like all connection to "https://*.domain.com"; are rewritten to "http://www.domain.com"; except for all connection to "https://*.domain.com/webmail"; that they must be concurred.

ex. https://pop.domain.com --> http://www.domain.com
    https://domain.com --> http://www.domain.com
    https://www.domain.com/webmail --> https://www.domain.com/webmail
    https://domain.com/webmail --> https://www.domain.com/webmail
    https://pop.domain.com/webmail --> https://www.domain.com/webmail

This also for the other domains (domain1.com, domain2.com ecc.)

Can you help me again??

Thanks

Marco



Reply to: