Apache mod_rewrite and 301 redirection

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

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux