我想知道是否有可能将某些特定页面从非www / http强制转换为www / https,而将其他某些页面保留为非www / http。
从非www / http到www / https:
[http://example.com至https://www.example.com
但是这些将仍然是非www和http:
我已经尝试在htaccess文件中添加此规则条件:
RewriteEngine On
# Enable HTTPS and WWW for homepage
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} off
RewriteRule ^$ https://example.com/ [R=301,L]
# Disable HTTPS and WWW for all pages
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} on
RewriteRule . http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
然后,它应仅将https和www强制设为主页,而将其他页面(如/ folder1 /和/ folder2 /保留为htpp非www。
但是似乎效果不佳
尝试这些:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^folder1.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^folder2.*$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^folder1.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^folder2.*$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^folder1.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
依此类推...