search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

1 answers
Q&A How to convert http to https using apache. Please give me more details. Thank you.

0

The apache server I want to use to convert http to https

I downloaded Alibaba Cloud’s free ssl certificate. How to configure it

Please be more detailed. Thank you

Your Answer
submit

1 answers
0

How to set http to automatically jump to https? In the apache environment, after configuring https, you need to set url redirection rules so that http access to website pages will automatically redirect to https access.

1. First enable url redirection support
1) Open Apache/conf/httpd.conf, find #LoadModule rewrite_module modules/mod_rewrite.so and remove the # sign.
2) Find the <Directory> section of your website directory. For example, my website directory is c:/www, find
<Directory “C:/www”>

&lt ;/Directory>
Modify AllowOverride None to AllowOverride All3) Restart the apache service 2. Set redirection rules
1) Place an .htaccess file in your website directory. In the Windows environment, you cannot directly rename the file to .htaccess. You will be prompted to enter the file name. So we first create a new "New Text Document.txt" document, open Notepad, select Save As, select "All Files (*.*)" as the save type, enter ".htaccess" as the file name, and save. This generates a .htaccess file.

2) Open the .htaccess file in the editor and write the following rules:
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REQUEST_URI } !^/tz.php
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R]

Explanation:
%{SERVER_PORT} —— Access port
%{REQUEST_URI} - For example, if the url is http://localhost/tz.php, it refers to /tz.php
%{SERVER_NAME} - For example, if the url is http://localhost/tz.php, It refers to localhost

The above rules mean that if the port of the accessed url is not 443 and the accessed page is not tz.php, the RewriteRule rule will be applied. This is achieved: when accessing pages such as http://localhost/index.php or http://localhost/admin/index.php, it will automatically jump to https://localhost/index.php or https:/ /localhost/admin/index.php, but no jump will be made when accessing http://localhost/tz.php, that is, http://localhost/tz.php and https://localhost/tz .php is accessible from both addresses.


2017-12-13 10:47:23

I tried your method but it didn’t work. Apache couldn’t start.

王亮 2017-12-16 18:19:46

Same

小盆友 2018-03-19 17:03:13

submit

Popular tool

vc9-vc14 (32+64 bit) runtime library collection (link below)

vc9-vc14 (32+64 bit) runtime library collection (link below)

Download the collection of runtime libraries required for phpStudy installation

VC9 32-bit

VC9 32-bit

VC9 32-bit phpstudy integrated installation environment runtime library

PHP programmer toolbox full version

PHP programmer toolbox full version

Programmer Toolbox v1.0 PHP Integrated Environment

VC11 32-bit

VC11 32-bit

VC11 32-bit phpstudy integrated installation environment runtime library

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use