linux system apache environment
Cloud server: [SSL deployed directly on apache] Create a new file in the root directory of the corresponding site (via ftp or log in to the wdcp management panel: site list - document management - enter public_html - create file) and name it .htaccess.
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !^on$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?abc.com$ [NC] # Jump abc.com and www.abc.com to https://www.abc.com to prevent the apache subsite from inheriting the upper-level directory. htaccess affected RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L] </IfModule>
Asia data center computer room:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:From-Https} !^on$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?abc.com$ [NC] # Jump abc.com and www.abc.com to https://www.abc.com to prevent the apache subsite from inheriting the upper-level directory. htaccess affected RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L] </IfModule>
Virtual host: You can enter the host management panel - file management through ftp or log in, enter wwwroot, create a new file named .htaccess file, and save it.
Edit the .htaccess file and write the following rules:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:From-Https} !^on$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?abc.com$ [NC] # Jump abc.com and www.abc.com to https://www.abc.com to prevent the apache subsite from inheriting the upper-level directory. htaccess affected RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L] </IfModule>
Nginx environment
Edit the nginx site configuration file (log in to the wdcp management panel: site list - document management - virtual host site file nginx - corresponding site configuration file) and add the following rules
server { listen 80; server_name abc.com; rewrite ^(.*) https://www.abc.com$1 permanent; # abc.com should be changed to your own domain name } Add the following code to the SSL deployed by CDN in Yashu computer room if ( $http_from_https != 'on' ){ rewrite ^(.*) https://www.abc.com$1 permanent; # abc.com should be changed to your own domain name }
Windows system IIS7 environment
Cloud server: [SSL deployed directly on IIS] Create a new file in the corresponding site root directory (via ftp or log in directly to D:\wwwroot\site ftp naming directory\wwwroot to create) and edit a file named web.config Add the following rules:
Asia Data Center Computer Room
Make sure to change it to your own domain name
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="301" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" /> </conditions> <action type="Redirect" url="https://www.abc.com/{R:1}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Copy the following rules for non-Yashu computer rooms, and be sure to replace them with your own domain names.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="301" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTPS}" pattern="^on$" negate="true" /> </conditions> <action type="Redirect" url="https://www.abc.com/{R:1}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Virtual host: You can enter the host management panel - file management through ftp or login, enter wwwroot, create a new file named web.config and edit and add the following rules. Be sure to replace it with your own domain name.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="301" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" /> </conditions> <action type="Redirect" url="https://www.abc.com/{R:1}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Windows system IIS6 environment
Refer to http://www.west.cn/faq/list.asp?unid=650 to configure a Rewrite, edit the Rewrite rule file httpd.conf and add the following rules.
RewriteEngine On RewriteCond %{HTTP:From-Https} !^on$ [NC] #RewriteCond %{HTTPS} !^on$ [NC] # Non-Asian computer rooms use this line to replace the previous line of rules RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L] # www.abc.com should be changed to your own domain name RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.abc.com$1 [R=301,L] # www.abc.com should be changed to your own domain name
tomcat environment
Just add the following code before the last line of web.xml</web-app> code
<security-constraint> <!-- Authorization setting for SSL --> <web-resource-collection > <web-resource-name >SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>