OpenLitespeed服务器WordPress的rewrite规则

作者: 站长 上传时间: 浏览: N/A 下载: N/A 格式: N/A 评分: N/A

WordPress基本的rewrite规则

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^/index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

将非https80端口重定向到https 443端口

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.your-domain.com/$1 [R,L]

将域名重定向到https域名

RewriteCond %{HTTP_HOST} ^www\.your-domain\.com
RewriteRule (.*) https://your-domain.com/$1 [R=301,L]

注意需要开启rewrite选项

最后平滑重启服务器即可

Leave a Comment