HTACCESS 删除 slug 不起作用



我的WordPress网站上有自定义帖子类型。它有鼻涕虫"笛子"所以网址现在就是这样site.com/dizi/mypost我想删除笛子鼻涕虫,这样它们就会site.com/mypost我尝试了很多wordpress功能,但没有一个起作用,然后我尝试htaccess,但它也不起作用。这是我的 htacess 文件

Options +FollowSymLinks -MultiViews
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^dizi/(.*)$ /$1 [L,NC,R]
</IfModule>
# END WordPress

使用此代码,我看不到任何效果。我确定存在网址冲突,因为我刚刚安装了wordpress,但我只有1个帖子。

更改行的顺序。/index 应该是最后一个,特殊模式应该在之前捕获:

RewriteRule ^dizi/(.*)$ /$1 [L,NC,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

最新更新