开发者

.htaccess RewriteCond if QUERY_STRING is NOT matched

开发者 https://www.devze.com 2023-03-25 23:29 出处:网络
Simple question to explain, with not simple solution to find for me. I\'m trying to trig a RewriteRule only if a certain QUERY_STRING is NOT matched.

Simple question to explain, with not simple solution to find for me.

I'm trying to trig a RewriteRule only if a certain QUERY_STRING is NOT matched. Something like:

RewriteCond %{QUERY_STRING} !mystring

Obviously this doesn't work, how can I express the NOT condition?

new informations

Substantially, I have a rule that forces HTTPS for all HTTP request, but I want some request to be forced back to HTTP (due to external not-https content) so that IE开发者_C百科 doesn't show the "not-https content" error.

RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)/my_page.php http://my_website.com/$1/mypage.php [R,L]

RewriteCond %{SERVER_PORT} 80
RewriteCond %{QUERY_STRING} !my_string
RewriteRule ^(.*)$ https://my_site.com/$1 [R]

The "!my_string" line represents what I'm trying to achieve, that is "force back to https" avoiding for a certain page (repesented by "my_string")

0

精彩评论

暂无评论...
验证码 换一张
取 消