2011-11-17 70 views
2
RewriteCond %{SERVER_PORT} !^443$ 
    RewriteRule MATCHME https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 

如果MATCHME不在URL中,那么将重写规则不被处理?你能把我链接到一些文档吗?.htaccess重写规则解释(简单)

+0

[Documentation](http://httpd.apache.org/docs/current/mod/mod_rewrite.html)(见底部) – Ryan

回答

1

这是正确的。如果图案MATCHME不存在,则不会发生重写。

如果你需要一个包罗万象的规则进行匹配,当你RewriteCond处于活动状态,您可以指定像一个附加规则:

RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule MATCHME https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 
# Catch-all rule 
RewriteRule ^(.*)$ https://%{SERVER_NAME}/someotherpage [L,R,QSA] 

审查mod_rewrite documentation