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

Re: Apache2 & mod_rewrite



On Fri, Sep 16, 2005 at 04:30:38PM +0200, Marco wrote:
> Hi Simo,
> the problem is not still this... :-)
> My server has following CNAME name on DNS server: www.domain.com, 
> pop.domain.com, smtp.domain.com ecc...
> I would like that a user digit on  his client  http://www.domain.com he 
> see the website and on his URL bar he see http://www.domain.com,
> but if a user digit on his client http://pop.domain.com I would like he 
> see the website but on his URL bar he see http://www.domain.com.
> Therefore like if a user digit on his client http://domain.com I would 
> like he see the website but on his URL bar he see http://www.domain.com
> 
> This must happen also for the other domains.
> ex. http://www.domain1.com --> http://www.domain1.com
> http://pop.domain1.com --> http://www.domain1.com
> http://smtp.domain1.com --> http://www.domain1.com
> http://domain1.com --> http://www.domain1.com
> 
> ex. http://www.domain2.com --> http://www.domain2.com
> http://pop.domain2.com --> http://www.domain2.com
> http://smtp.domain2.com --> http://www.domain2.com
> http://domain2.com --> http://www.domain2.com
> 
> If I put only the option "ServerAlias", the bar of the client doesn't 
> come rewritten.
> 
> I attend your news...
> Thanks
> 
> Marco

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
-- 
:r ~/.signature

Attachment: signature.asc
Description: Digital signature


Reply to: