OpenLitespeed服务器WordPress的rewrite规则

WordPress基本的rewrite规则

1
2
3
4
5
6
7
8
# 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端口

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

将域名重定向到https域名

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

注意需要开启rewrite选项

最后平滑重启服务器即可

原文链接:https://xiaohost.com/3665.html,转载请注明出处。
0

评论0

请先