【问题标题】:404 error not work for /%post_id%/%postname%.html404 错误不适用于 /%post_id%/%postname%.html
【发布时间】:2015-02-27 11:42:36
【问题描述】:

我在我的 wordpress 永久链接中使用 /%post_id%/%postname%.html。
如果帖子或页面不存在,则 404 错误不适用于此永久链接。

但是对于另一个链接 404 工作良好。 这是我的 htaccess 文件:

RewriteEngine On
     RewriteBase /
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


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

感谢您的帮助。

【问题讨论】:

    标签: php wordpress .htaccess


    【解决方案1】:

    检查this可能对你有帮助

    将 apache 设置为“AllowOverride All”

    mod_rewrite 存在,.htaccess 看起来像这样:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wikiarr_prd/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wikiarr_prd/index.php [L]
    </IfModule>
    
    # END WordPress
    
    Permalinks structure:
    
    /%postname%_%post_id%.html
    

    【讨论】:

    • 感谢您的回答,但无法使用此方法。在我的 vps 中的其他站点中正常工作,但在此站点中不起作用。
    猜你喜欢
    • 1970-01-01
    • 2013-04-28
    • 2019-10-23
    • 2014-08-04
    • 2014-07-26
    • 1970-01-01
    • 1970-01-01
    • 2011-08-01
    • 2014-12-17
    相关资源
    最近更新 更多