我有.htaccess文件和代码只在woocommerce商店的页面上提供https并且工作完美。那么如何添加允许页面上的https使用GET参数'yandex_money = check'的规则,例如https://example.com/?yandex_money=check
RewriteEngine On
# Force HTTPS for /(cart|checkout|my-account|product-category|shop|product)
RewriteCond %{HTTPS} !=on
RewriteCond %{THE_REQUEST} ^[A-Z]+\s/(cart|checkout|my-account|product-category|shop|product) [NC]
RewriteRule ^(cart|checkout|my-account|product-category|shop|product) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
# Force HTTP for anything which isn't /(cart|checkout|my-account|product-category|shop|product)
RewriteCond %{HTTPS} =on
RewriteCond %{THE_REQUEST} !^[A-Z]+\s/(cart|checkout|my-account|product-category|shop|product) [NC]
RewriteRule !^(cart|checkout|my-account|product-category|shop|product) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
答案 0 :(得分:0)
所以解决方案是
修复.htaccess文件:
RewriteEngine On
# RewriteCond %{HTTPS} on
# RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Force HTTPS for /(cart|checkout|my-account|product-category|shop|product|wp-admin|wp-login) GET[yandex_money]
RewriteCond %{THE_REQUEST} ^[A-Z]+\s/(cart|checkout|my-account|product-category|shop|product|wp-admin|wp-login) [OR,NC]
#RewriteCond %{QUERY_STRING} ^yandex_money=check [NC]
RewriteCond %{HTTPS} !=on
RewriteRule ^(cart|checkout|my-account|product-category|shop|product|wp-admin|wp-login) https://%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING}[NC,R=301,N]
RewriteRule ^(yandex_money) https://%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING}[NC,R=301,L]
# Force HTTP for anything which isn't /(cart|checkout|my-account|product-category|shop|product|wp-admin|wp-login)
RewriteCond %{HTTPS} =on
RewriteCond %{THE_REQUEST} !^[A-Z]+\s/(cart|checkout|my-account|product-category|shop|product|wp-admin|wp-login) [NC]
RewriteCond %{QUERY_STRING} !^yandex_money=check [NC]
RewriteRule !^(cart|checkout|my-account|product-category|shop|product|wp-admin|wp-login) http://%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING}