Apache: Except a path from RewriteRule
I'm trying to except from being redirected to /portal/
if you access to /sitemapHT/
but it seems that this process ^(/$|!sitemapHT)
is wrong, since it still redirecting me to /portal/
<VirtualHost *:80>
DocumentRoot "/opt/tomcat-5.5.30/webapps/portal"
ServerName hoteles
ServerAlias hoteles
JkUnMount /images/*.gif w1
JkUnMount /images/*.png w1
JkUnMount /images/*.jpg w1
JkUnMount /js/*.js w1
JkUnMount /styles/*.css w1
JkMount /portal w1
JkMount /portal/* w1
RewriteEngine on
开发者_Python百科 RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
Options +FollowSymlinks
RewriteRule ^(/$|!sitemapHT) /portal/ [R]
RewriteRule ^/(?!portal)(.*) /portal/ficha.action/$1 [PT]
</VirtualHost>
Could you suggest me a proper correction?
Thank you!
I hope I understood you correctly:
RewriteCond $1 !^/(sitemapHT/|portal/)
RewriteRule ^(.*) /portal/ [R,L]
This will redirect (302 code) ALL incoming requests to /portal/
EXCEPT /sitemapHT/
or when requesting /portal/
directly.
UPDATE:
RewriteCond $1 !^/(sitemapHT/|portal/)
RewriteRule ^(.*) /portal/ [R,L]
RewriteCond $1 !^(sitemapHT/|portal/)
RewriteRule ^/(.*) /portal/ficha.action/$1 [PT]
Use the above rules instead of your last 2 lines:
RewriteRule ^(/$|!sitemapHT) /portal/ [R]
RewriteRule ^/(?!portal)(.*) /portal/ficha.action/$1 [PT]
精彩评论