我试图让我网站的整个目录/部分使用 .htaccess 文件自动重定向到 https(安全),所以我在这里找到了解决方案。事实证明,它将我的 ENTIRE 站点重定向到 HTTPS,但主页除外。我希望它只重定向/php/文件夹和其中的任何内容。
在此先感谢您的帮助!
这是我在 .htaccess 中的代码:
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} php
RewriteRule ^(.*)$ https://beanstalkwebsolutions.com/$1 [R,L]
最佳答案
您可以将此规则用作您的第一条规则:
RewriteCond %{HTTPS} off
RewriteRule ^php(/|$) https://beanstalkwebsolutions.com%{REQUEST_URI} [NC,R,L]
关于.htaccess - 重定向到 .htaccess 中的 https 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21822627/