2011-11-17 149 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