This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11140|Reply: 0

[Web] HTTP traffic redirected to HTTPS configuration tutorial

[Copy link]
Posted on 6/21/2019 9:45:17 AM | | |
Apache Server: Web Host File Approach (Recommended)

1. Open the Apache configuration file. The file may be located in the following directories: /etc/httpd/conf/httpd.conf (Apache 2/httpd), /etc/apache2/sites-enabled/ (Apache 2.4), or /etc/apache2/apache2.conf (Apache on Ubuntu).

2. Add a rewrite rule like the following to the VirtualHost section of the configuration file:
3. Save the Apache configuration file.

4. Restart Apache.

Apache server: .htaccess file method (not recommended)

Warning: It is best to use the Apache web host file method described in the previous section. According to the Apache .htaccess file guidelines, use .htaccess files only when you do not have access to the Apache master configuration file.

1. Open the Apache configuration file. The file may be located in the following directory: /etc/httpd/conf/httpd.conf (Apache 2/httpd) or /etc/apache2/sites-enabled/ (Apache 2.4).

2. Edit the Directory command to enable .htaccess as shown below:


3. Save the Apache configuration file.

4. Open the .htaccess file.

5. Add a rewrite rule like the following:


6. Save the .htaccess file.

7. Restart Apache.

NGINX servers

Note: This workaround works for NGINX 1.10.3 (Ubuntu) and NGINX 1.12.1 (Amazon Linux).

1. Open the NGINX configuration file (nginx.conf).

2. Add the following example rewrite rule. Be sure to modify the rewrite rules according to your configuration.


3. Restart NGINX.

IIS server

Note: This workaround works with Microsoft Windows Server 2012 R2 and 2016 Base.

1. Install the IIS URL Rewriting module provided by Microsoft.The hyperlink login is visible.

2. Open the web.config file.

3. Add the following example rewrite rule to the <system.webServer> section. Be sure to modify the rewrite rules according to your specific configuration.


4. Save the web.config file.

5. Open IIS Manager.

6. Refresh the default website.

7. Confirm that the new rewrite rule appears in the URL Rewrite section.

8. Restart the website.

9. Confirm that the redirect is active.





Previous:Use EF Core MySQL data migration operations in .NET Core
Next:Unrecognized escape sequences
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com