简体   繁体   中英

how to remove a https redirection for only one .php file in htaccess

I want to remove the https redirection for my web page only for one .php file. I found this but I don't know how to set my .php direction. Thanks in advance

.php file = www.myhost.com/myphp.php

# force http:// for selected URLs
RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} /commerce_paypal/ [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

You have your condition reversed. You need to use this:

# force https:// to all but selected URLs
RewriteCond %{HTTPS} !on
RewriteCond %{THE_REQUEST} !\s/+myfile\.php [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# force http:// to selected URLs
RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} \s/+myfile\.php [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM