重写规则 - httpd.conf

时间:2011-07-14 07:11:57

标签: mod-rewrite apache

我在httpd.conf

中有以下条目
<VirtualHost *:80>
    ServerName www.mydomain.com
    RewriteEngine on
    RewriteRule ^/(.*) http://www.anotherdomain.uk.com/ [L,R=302]
</VirtualHost>

我希望安排这样做,以便在输入www.mydomain.com/admin时我不会被重定向。

1 个答案:

答案 0 :(得分:5)

<VirtualHost *:80>
     ServerName www.mydomain.com

     RewriteEngine on
     RewriteCond %{REQUEST_URI}  !^/admin
     RewriteRule ^/(.*) http://www.anotherdomain.uk.com/ [L,R=302]
</VirtualHost>