我的所有Wordpress网站都遇到了问题。内页网址之后的数字字符(如http://domainname.com/about-us/123452345/
)应显示404网页错误,但它们会在http://domainname.com/about-us/
上显示该网页。
有没有办法让它显示404页面。
我试过了domainname.com/about-us/asdfasdfas
,它显示了404页面很棒。但是使用数字会使它显示页面。
更新
我在.htaccess中试过这个:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule ^about-us/[0-9]+/?$ /doesnotexists.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
答案 0 :(得分:0)
我不知道wordpress,但是如果你想通过htaccess规则解决这个问题,试试这个(确保doesnotexists.php
不存在,以便抛出404标题):
RewriteEngine on
RewriteRule ^about-us/[0-9]+/?$ /doesnotexists.php [L]