.htaccess强制http特定子目录

时间:2018-09-06 15:45:17

标签: .htaccess http redirect mod-rewrite https

我已在.htaccess文件中设置将每个URL重定向到https。

我要添加的内容是将其排除在特定的子目录之外

例如:www.mysite.com/myfiles <-不要强制使用https 例如:www.mysite.com/everythingelse <-强制使用https

到目前为止,我的.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

0 个答案:

没有答案