简体   繁体   中英

Redirect https to http except onepagecheckout in .htaccess

I want to redirect all my https to http except for this below url.

https://uae.example.com/ae_en/onepagecheckout/

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^$onepagecheckout
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

This code is working and redirecting all https to http but it seems my 2nd RewriteCond is not working. Please help

Have it this way:

RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} !/onepagecheckout [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]

Use %{THE_REQUEST} variable instead of %{REQUEST_URI} with correct regex pattern.

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