apache sets the method to automatically jump http to https

  • 2020-05-06 12:09:18
  • OfStack


<Directory "/opt/fivetrees">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All # This was originally None To change to All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory> 

First, create the.htaccess file in the root directory of the site, and at the bottom add the following statement:


RewriteEngine on
RewriteBase / # My row has no configuration 
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]


Related articles: