.htaccess - 仅强制主页为非 SSL

标签 .htaccess ssl

我需要写一个 htaccess 只强制主页非 ssl

因此,如果您要访问 https://www. 123.com 或 https://123.com它将重定向/强制它转到 http://www. 123.com 或 http://123.com .

我只想在主页上进行此更改。

最佳答案

我没有要测试的 https 框,但我认为这些规则应该可以满足您的要求:

<IfModule mod_rewrite.c>

RewriteEngine On 

# Only rewrite if using HTTPS and that we're on the index page, then redirect to http
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/index.[a-z]+$ [NC]
RewriteRule .+ http://%{SERVER_NAME}%{REQUEST_URI} [R,QSA]

</IfModule>

关于.htaccess - 仅强制主页为非 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14966816/

相关文章:

.htaccess - 如何隐藏所有控制台错误

jquery - WordPress 主题 : The font awesome icons not displayed

asp.net - IIS 7 如何将客户端证书映射到数据库中的用户帐户?

ssl - 适用于 IIS 的 ELB 上的 ACM

python - 在不重建的情况下在 Python 3.6 上安装 SSL 模块

SSL 握手失败 : When connecting to TIBCO ActiveMatrix BusinessWorks 5. 7.2

php - 使用 php .htaccess 为多语言系统生成 seo 友好的 url

php - 如何修复 htaccess ssl https 重定向?

apache - HTACCESS - 大写到小写,异常(exception)

python - 尝试使用 python-mysql-connector 建立与 Mysql 服务器的 SSL 连接时访问被拒绝