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

Re: Apache2 & mod_rewrite



Marco wrote:

Hi,
I have removed the Rewrite rule on my Virtual Host configuration file, I have added the
rule ServerAlias domain1.com *.domain1.com, and I have restart apache2.

Test: http://www.domain1.com --> OK
http://domain1.com --> PAGE NOT FOUND ???

I have also an other question, using the server alias option when a client visit http://domain1.com
its URL comes rewritten in http://www.domain1.com????

Here is what I have for my own vhost configurations:

<VirtualHost *:80>
ServerName descartes.homelinux.org
ServerAlias www.descartes.homelinux.org
...
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.descartes\.homelinux\.org$ [NC]
RewriteRule ^(.*)$ http://descartes.homelinux.org/$1 [R=301,L]
</VirtualHost>

I think this does the opposite that you want to do: it redirects www.domain.com to domain.com

On a side note, does anyone know whether or not it is technically "better" to use R=301 or R=permanent ?




Reply to: