我有以下重寫規則:「^」是什麼和「!」意味着在Apache配置?
# Rewriting without query parameters to avoid cache overloading
RewriteCond %{REQUEST_URI} /(en|fr)/search-results.html
RewriteCond %{QUERY_STRING} ^.
RewriteCond %{QUERY_STRING} !referrerPage=automotive-home
RewriteRule ^(.*)/search-results.html$ $1/search-results.html? [NC]
據我瞭解
RewriteCond %{REQUEST_URI} /(en|fr)/search-results.html
將返回true,如果{REQUEST_URL}
會喜歡:
https://www.trololo.com/en/search-results.html
https://www.trololo.com/fr/search-results.html
請解釋最後兩個RewriteCond
S:
RewriteCond %{QUERY_STRING} ^.
RewriteCond %{QUERY_STRING} !referrerPage=automotive-home
RewriteCond %{QUERY_STRING} ^.
這是否意味着QUERY_STRING
不是空白%{QUERY_STRING} !referrerPage=automotive-home
這是否意味着QUERY_STRING
不含referrerPage=automotive-home
?
http://httpd.apache.org/docs/2.2/rewrite/intro.html – 2014-12-02 14:09:20
我什麼都看不到**!** – gstackoverflow 2014-12-02 14:12:07
仔細一看:'在mod_rewrite中!可以在正則表達式之前使用字符否定它。「 – 2014-12-02 14:12:34