问题
I've got a site that requires (obviously) HTTPS for checkout. The current fix put in place involved making the whole site run in SSL mode, but this is causing problems.
How would I change this...
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
To only set a certain URL (say basket.php) as HTTPS?
回答1:
I beleive this would work:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /basket.php
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
回答2:
A shorter version:
RewriteCond %{HTTPS} off
RewriteRule ^basket\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [L]
来源:https://stackoverflow.com/questions/1213404/using-htaccess-to-control-https-on-certain-pages