Multiple RewriteCond for multiple RewriteRules
I'm using these rewrite rules that only go into effect if there is NOT a "user" cookie.
RewriteCond %{HTTP_COOKIE} (user)
RewriteRule (.*)? - [S=5] # Skip the below 5 lines if the above test passes
RewriteRule ^$ app/webroot/cache_static_html/cache_static_popular_results_1.html [L]
RewriteRule ^popular/page:2$ app/webroot/cache_static_html/cache_static_popular_results_2.html [L]
RewriteRule ^popular/page:3$ app/webroot/cache_static_html/cache_static_popular_results_3.html [L]
RewriteRule ^popular/page:4$ app/webroot/cache_static_html/cache_static_popular_resul开发者_运维技巧ts_4.html [L]
RewriteRule ^popular/page:5$ app/webroot/cache_static_html/cache_static_popular_results_5.html [L]
Now, how can I add another condition that there must not be a query string value? If there is a "user" cookie OR a query string, those 5 rules should be skipped.
RewriteCond %{HTTP_COOKIE} (user) [OR]
RewriteCond %{QUERY_STRING} ^user=(.*) #assuming ?user=xyz
RewriteRule (.*)? - [S=5] # Skip the below 5 lines if the above test passes
RewriteRule ^$ app/webroot/cache_static_html/cache_static_popular_results_1.html [L]
RewriteRule ^popular/page:2$ app/webroot/cache_static_html/cache_static_popular_results_2.html [L]
RewriteRule ^popular/page:3$ app/webroot/cache_static_html/cache_static_popular_results_3.html [L]
RewriteRule ^popular/page:4$ app/webroot/cache_static_html/cache_static_popular_results_4.html [L]
RewriteRule ^popular/page:5$ app/webroot/cache_static_html/cache_static_popular_results_5.html [L]
精彩评论