You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Norman Khine <no...@khine.net> on 2006/11/29 16:54:26 UTC
[users@httpd] Apache mod_rewrite and 301 redirection
Hello,
I am using a ZOPE server behind Apache and already have a mod_rewrite
rule as:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
RewriteEngine On
RewriteRule ^/(.*)
http://mysite.com:5080/VirtualHostBase/http/mysite.com:80/sites/site/VirtualHostRoot/$1
[L,P]
ErrorLog /var/log/apache2/site_error.log
CustomLog /var/log/apache2/site_access.log combined
RewriteLog /var/log/apache2/site_rewrite_log
</VirtualHost>
Now I would like to add the 301 re-direction before the second rule is
taken into effect so that if user types www.mysite.com they are
redirected to just the mysite.com and only then will they be taken to
the site
Can I just have it:
RewriteCond %{HTTP_HOST} ^www\.mysite\.com [nc]
RewriteRule (.*) http://mysite.com/$1 [R=301,L]
RewriteRule ^/(.*)
http://mysite.com:5080/VirtualHostBase/http/mysite.com:80/sites/site/VirtualHostRoot/$1
[L,P]
....
OR?
Many thanks
Norman
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org