鍍金池/ 問答/HTML/ http和https相關(guān)的問題?

http和https相關(guān)的問題?

怎么使自己的網(wǎng)站在輸入http時(shí),不允許訪問,使其轉(zhuǎn)化為https即可訪問?
回答
編輯回答
帥到炸

301重定向
在Apache 中,有個(gè)很重要的文件.htaccess,通過對它的設(shè)置,可以實(shí)現(xiàn)很多強(qiáng)大的功能,301 重定向只是其中之一。

2018年3月9日 01:21
編輯回答
編輯回答
萌面人

Apache的配置文件參考在官方文檔就有: https://wiki.apache.org/httpd...

配置原理都跟Nginx的一樣,你既可以使用虛擬主機(jī)Redirect跳轉(zhuǎn),也可以公用一個(gè)VirtualHost使用Rewrite跳轉(zhuǎn)

2017年7月9日 16:23
編輯回答
瞄小懶

可以把 morethink.cn和www.morethink.cn合并到一個(gè)server上去,使用301永久重定向。
然后將 https://morethink.cn 轉(zhuǎn)到 https://www.morethink.cn 去。不過要在https://www.morethink.cn
配置default_server ssl;。
301永久重定向可以把搜索引擎的權(quán)重全部集中到 https://www.morethink.cn 上。

配置如下:

    server {
        listen       80;
        server_name morethink.cn,www.morethink.cn;
        return 301 https://www.morethink.cn$request_uri;
    }
    server {
        listen 443;
        server_name morethink.cn;
        return 301 https://www.morethink.cn$request_uri;
    }
    server {
        listen 443 default_server ssl;
        server_name  www.morethink.cn;
    # ssl配置
    }
2018年2月11日 07:53
編輯回答
淡墨

直接寫偽靜態(tài) 做 301 重定向
將http請求轉(zhuǎn)到https即可

2017年8月26日 09:45
編輯回答
墨染殤

這個(gè)需要在服務(wù)器端進(jìn)行重定向配置,不同的服務(wù)器程序有不同的設(shè)置方法,你要參考對應(yīng)的。

2017年12月30日 19:23
編輯回答
薔薇花

重定向即可!比如nginx,啟用http2,其中版本要在1.90以上,然后先配置443端口,最后把http 80端口請求轉(zhuǎn)發(fā)到443

2017年1月14日 07:49