redirect http to https through httpd.conf

后端 未结 2 389
夕颜
夕颜 2021-01-25 09:02

Need to change http to https.

http://myServerName/itf/sheldon/imex/ajax/share_details/v1/CH0012221716/issuer/contact.json **Should change to**          


        
相关标签:
2条回答
  • 2021-01-25 09:23

    I found the solution: To change particular or any http call to https call, put the code in

    VirtualHost :80
       ErrorLog /var/log/httpd/error_log
       CustomLog logs/access.log common
       LogLevel info
       RewriteCond %{HTTPS} off
       RewriteEngine On
       RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
       RewriteEngine On
    
    0 讨论(0)
  • 2021-01-25 09:42

    Set up your virtual host file / httpd.conf to have lines

    <VirtualHost *:80>
      ServerName enter.yoursite.com
      Redirect / https://enter.yoursite.com/
    </VirtualHost>
    
    <VirtualHost *:443>
      ServerName enter.yoursite.com
      ServerAdmin some@email.com
      Insert EVERYTHING else in here (rewrite rules, log file stuff, etc)
    </VirtualHost>
    

    This will force the website to always redirect to HTTPS and then load all the configurations you want under HTTPS.

    0 讨论(0)
提交回复
热议问题