How to redirect all HTTP requests to HTTPS

前端 未结 26 2200
小鲜肉
小鲜肉 2020-11-22 00:40

I\'m trying to redirect all insecure HTTP requests on my site (e.g. http://www.example.com) to HTTPS (https://www.example.com). I\'m using PHP btw.

26条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-22 01:07

    If you want to do it from the tomcat server follow the below steps

    In a standalone Apache Tomcat (8.5.x) HTTP Server, how can configure it so if a user types www.domain.com, they will be automatically forwarded to https(www.domain.com) site.

    The 2 step method of including the following in your [Tomcat_base]/conf/web.xml before the closing tag

    step 1: 
    
    
    HTTPSOnly
    /*
    
    
    CONFIDENTIAL
    
    
    

    and setting the [Tomcat_base]/conf/server.xml connector settings:

    step 2:
    
    
    
    
    
    
    

    Note: If you already did the https configuration and trying to redirect do step 1 only.

提交回复
热议问题