httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norman Khine <nor...@khine.net>
Subject [users@httpd] Apache mod_rewrite and 301 redirection
Date Wed, 29 Nov 2006 15:54:26 GMT
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


Mime
View raw message