【发布时间】:2016-02-04 03:52:12
【问题描述】:
HTTP 和 HTTPS 的工作方式取决于用户在浏览器中键入的内容。 示例 我有一个名为 http://example 的网站。 com 并且它正在工作和生活,然后我想让它适用于 https://example 之类的东西。 com.
如果用户输入了
http: //example .c om
同样会起作用
https: //example .c om
我有这样的 htaccess 文件
Options FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html
我试过用这个
RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
RewriteRule ^(.*)$ - [env=askapache:%2]
这个
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https: // example. com/$1 [P,L]
RewriteRule ^(.*)$ http:// example . com/$1 [P,L]
还有这个
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ - [env=ps:https]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ - [env=ps:http]
仍然无法正常工作。我只能访问http但我不能访问https。 该example.c o m 只是一个简单的网页,不包含任何安全风险。 我的链接上有空格,因为我不能发布超过 1 个链接
【问题讨论】:
标签: apache .htaccess http https