Apache环境中实现typecho伪静态并强制301跳转https


第一次用Typecho这个程序,摸着石头过河,配置伪静态和SSL证书花了不少时间。
在网站根目录新建.htaccess文件,放入以下代码:

<IfModule mod_rewrite.c>
RewriteEngine On
 
#伪静态
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,E=PATH_INFO:$1]
#强制跳转https
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [L,R=301]
</IfModule>

声明:极客角度|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - Apache环境中实现typecho伪静态并强制301跳转https


拒绝拖延,勇于表达!