wordpress迁移/更换服务器后固定链接404错误

in #wordpress6 years ago (edited)
症状
  • 迁移/更换服务器后,wordpress站点首页正常;
  • 若固定链接格式为默认格式,自定义就404错误;
Nginx

在网站的Nginx配置文件的{ }位置之间添加如下代码,并重启Nginx

location / {
 try_files $uri $uri/ /index.php?q=$uri&$args;
}
Apache或litespeed

进入网站文件夹,编辑.htaccess,添加/编辑如下代码,并重启apache或litespeed

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 
RewriteRule ^/index\.php$ - [L]   # 就是在^ index\.php$ 加  /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule>

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.032
BTC 65852.33
ETH 2958.72
USDT 1.00
SBD 3.73