Sign in QQ login WeChat login
All categories

How does Z-blog force websites to use https by modifying pseudo static configuration files

finchui seven hundred and thirty-eight 2023-06-26 10:05:53

 image.png

Apache + .htaccess

You can add the following rules in the. htaccess file to force https visit:

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L, R=301]


The modified. htaccess file is as follows:

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

#Add the following rule to enforce HTTPS

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L, R=301]

 RewriteCond %{REQUEST_FILENAME} !- f

RewriteCond %{REQUEST_FILENAME} !- d

RewriteRule . /index.php [L]

</IfModule>

  • Dislike( one

Link to this article: https://www.finchui.com/zblog-course/53.html

Netizen comments

Hot commodity
Popular articles
Hot tags
Related labels
 FinchUI Store Edition

share

Copy Link

Xinglan Studio Online consultation

Working hours: 9:00-22:00
Saturday and Sunday: 14:00-22:00