Simo Kauppi ha scritto:

Hey Marco,

I thought I knew what you was trying to do, but now I think I don't :(

The rewrite rule that we started with does exactly that, i.e. it
rewrites the clients request domain1.com to www.domain1.com. I thought
this was what you were trying to do originally.

Anyway, now I think you are just trying to create site which has name
based virtual hosts, which respond to domainx.com and www.domainx.com so
here goes...

First you need your main site, let's call it www.domain.com and the
ip-address for your site is xxx.xxx.xxx.xxx

You create a file 000-domain in your /etc/apache2/sites-enabled (you
actually create it in /etc/apache2/sites-available directory and symlink
it in the /etc/apache2/sites-enabled). The file is something like this:

NameVirtualHost xxx.xxx.xxx.xxx
<VirtualHost xxx.xxx.xxx.xxx>
        ServerAdmin [EMAIL PROTECTED]
        ServerName www.domain.com
        
        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>

Then you create a file 001-domain1 for your first virtual host

<VirtualHost xxx.xxx.xxx.xxx>
        ServerAdmin [EMAIL PROTECTED]
        ServerName www.domain1.com
        ServerAlias domain1.com
        
        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>

Then you create a file 002-domain2 for your second virtual host

<VirtualHost xxx.xxx.xxx.xxx>
        ServerAdmin [EMAIL PROTECTED]
        ServerName www.domain2.com
        ServerAlias domain2.com
        
        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>

And restart your apache.

Now you have three severs, first one is the default if none of the other
ones have matching server name for the request. You have your main
server files in /var/www directory, the first virtual host files in
/var/www/domain1 and the second virtual host files in /var/www/domain2.
The virtual servers will respond to domainx.com and www.domainx.com and
only for those two variants and nothing gets rewritten.

You also have the per server log files in your /var/log/apache2/.

Let me know if this is what you are trying to achieve.

Simo

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


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to