我怎么可以通过.htaccess打开https到所有页面而不是首页。任何人都可以帮我改写。
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=302,L]
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
我已经有了这个,我的目标是为HTTPS排除FRONTPAGE,只有内部/子页面应该有HTTPS。
请帮我修改现有的。谢谢。
答案 0 :(得分:0)
您可以使用以下规则:
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.+)$ https://www.mydomain.com/$1 [R=301,L,NE]
RewriteCond %{HTTPS} on
RewriteRule ^$ http://www.mydomain.com/ [R=301,L]
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
.+
代替.*
,确保对除了首页以外的其他子页面强制执行http。