如何解决Wordpress设置固定链接后,子菜单无法打开

需要添加伪静态规则,在Apache或者nginx下添加。

如果是Apache服务器,把以下内容添加到.htaccess

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

扫描二维码关注公众号,回复: 4369536 查看本文章

如果是Nginx服务器,虚拟主机配置文件添加如下代码:(要包含在server块里)

location / {

if (-f $request_filename/index.html){

                rewrite (.*) $1/index.html break;

        }

if (-f $request_filename/index.php){

                rewrite (.*) $1/index.php;

        }

if (!-f $request_filename){

                rewrite (.*) /index.php;

        }

}

猜你喜欢

转载自blog.csdn.net/lihuang319/article/details/79896421