我有一个名为域:example.com和一个叫子域名:sub.example.comHTTPS子域不正确htaccess的重定向
我要强制为example.com中的所有主域请求到https: //除了1个文件夹。例如:
http://www.example.com/ <-- Redirect all requests to https://
http://www.example.com/folder/ <-- Force to http:// not https://
我也想强制sub.example.com的所有子域请求到https://除了1个文件夹。例如:
http://sub.example.com <-- Redirect all requests to https://
http://www.example.com/folder/ <-- Force to http:// not https://
目前example.com是工作的罚款,并强制将https://开头的主域和文件夹重定向没有到https://但是文件夹没有强制执行的http://如果有人选择https://
如果我访问http://sub.example.com
它不强制执行https://,如果我手动访问https://sub.example.com
,它会在url中显示。但是它显示的网站实际上是从https://www.example.com
htaccess的文件我有example.com是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteCond %{HTTP_HOST} !^sub.example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,QSA,L]
</IfModule>
htaccess的文件我有sub.example.com是:
RewriteEngine on
RewriteBase/
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/folder/
RewriteCond %{HTTP_HOST} ^example\.com\.au$ [NC]
RewriteRule^https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]