HTTP->HTTPS 301 自动跳转配置

默认分类 · 2018-02-10 · 936 人浏览
HTTP->HTTPS 301 自动跳转配置

如果你的域名配置了SSL证书,并希望用户每次访问都通过https协议访问,即使用户输入了http协议访问,系统也能自动跳转到https协议的页面。这里用到301静态跳转。

1、首先确定你的服务器支持htaccess,如果你不知道服务器是否支持htaccess,你可以按照下面的教程操作一遍,如果无效,那么就说明你的服务器不支持htaccess,而后你可以百度/Google一下服务器如何开启htaccess

2、对于支持htaccess的服务器,在你的网站根目录新建一个文件,重命名为.htaccess(注意htaccess前面有一个“.”,win OS是不支持这样命名方式的,我用的是Linux服务器),打开编辑,在里面输入以下内容:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=301,L]
</IfModule>

保存,关闭。

重启服务器,你会发现不论你输入的是http://url还是https://url,浏览器总是会自动跳转到https://url地址


  1. [url=https://oazithromycin.com/]azithromycin generic brand[/url]

  2. Divroj 前天

    generic terbinafine - purchase diflucan online buy grifulvin v without prescription

  3. Hprvek 前天

    rybelsus 14mg without prescription - DDAVP medication purchase desmopressin online

  4. Cpyhnh 4 天前

    buy repaglinide 1mg for sale - repaglinide 2mg pills jardiance online buy

  5. Dglbgo 5 天前

    order metformin 1000mg generic - buy glycomet 500mg purchase precose for sale

  6. lisinopril 2 6 天前

    [url=http://lisinoprilos.online/]lisinopril 5[/url]

  7. Gfzzjh 6 天前

    buy micronase generic - buy micronase 2.5mg online cheap cost forxiga

  8. Byixfd 8 天前

    desloratadine over the counter - order flixotide for sale buy ventolin without a prescription

  9. Ulzmna 9 天前

    methylprednisolone without prescription - astelin over the counter astelin 10 ml cost

  10. Ggecfz 11 天前

    albuterol ca - order promethazine 25mg without prescription order theophylline 400mg generic

  11. Eyhmrq 12 天前

    ivermectin 3mg for people - purchase levofloxacin pill cefaclor 500mg generic

  12. Oqpacj 14 天前

    how to buy clindamycin - purchase chloromycetin online buy chloramphenicol online cheap

  13. Tavesy 15 天前

    azithromycin canada - tindamax ca purchase ciplox without prescription

  14. Bwajbc 20 天前

    buy amoxicillin generic - order keflex generic order ciprofloxacin 500mg

  15. Pncbch 21 天前

    purchase amoxiclav without prescription - buy cipro online cheap cipro order online

  16. Qrhcih 23 天前

    purchase hydroxyzine pills - buy endep generic order generic amitriptyline 10mg

  17. Ysjfny 25 天前

    order clomipramine 50mg generic - order imipramine 25mg cost doxepin 75mg

  18. Rrkrfd 25 天前

    order quetiapine online - order bupropion without prescription purchase eskalith

  19. Qugfyo 28 天前

    clozapine 100mg cost - famotidine 40mg oral buy generic famotidine over the counter

  20. Pmfwgq 28 天前

    retrovir price - roxithromycin 150 mg cheap buy allopurinol 300mg without prescription

  21. Kotaen 30 天前

    metformin canada - duricef 500mg canada lincocin generic

  22. Pusfqi 03-24

    furosemide 40mg oral - order tacrolimus generic buy captopril 25mg for sale

  23. Cwhdis 03-18

    order metronidazole sale - azithromycin 500mg cheap zithromax price

  24. Snrzlf 03-17

    brand ciplox - doxycycline ca buy generic erythromycin

  25. Ykgnhr 03-15

    order cipro 500mg without prescription - brand myambutol purchase augmentin generic

  26. Chpzlu 03-14

    buy cipro tablets - buy sulfamethoxazole pills purchase amoxiclav generic

  27. Pljlvg 03-13

    order generic lipitor 20mg buy atorvastatin 80mg pill buy lipitor for sale

Theme Jasmine by Kent Liao And Bill

本站由提供云存储服务