自定义结构固定链接错误404

时间:2013-11-15 作者:mehdi

我已将wordpress自定义结构permalink更改为/%post_id%/%postname%/ 并获取此错误:

404 Not Found The requested URL /mysite/blog/1/hello-world/ was not found on this server.

    wordpress版本3.1.7 localhost/mysite/blog
i\'v在中更改了此功能misc.php 再次看到错误!

function got_mod_rewrite() {
    //$got_rewrite = apache_mod_loaded(\'mod_rewrite\', true); //old line with false negative;
    $got_rewrite = true;//force the response to true as we know mod_rewite is installed;
    return apply_filters(\'got_rewrite\', $got_rewrite);
}

2 个回复
最合适的回答,由SO网友:Mayeenul Islam 整理而成

Mehdi,这是一个常见的问题,因为默认情况下Apache服务器并不是以这种方式设置的。您的问题可以通过一些非常简单的步骤来解决(简单引用Samuel B):

如果要使用permalinks,需要在另一个文件中进行更改:apache>Conf并找到该文件httpd.conf. 在文本编辑器中打开它。使用编辑器中的搜索工具查找“重写”。您需要的线路如下所示:

#LoadModule rewrite_module modules/mod_rewrite.so

你需要去掉散列符号,这样看起来像这样

LoadModule rewrite_module modules/mod_rewrite.so

现在只需保存文件。

参考号:WordPress Support - Answer by Samuel B

还有一个警告:

REMEMBER:
NEVER EVER EDIT A CORE WORDPRESS FILE, IT\'LL SIMPLY MAKE YOUR WP BUGGY.

SO网友:Raush

我想使用如下自定义结构永久链接:www.example.com/blog/post/%post_id%/%postname%/

但只要把这个/blog/post/%post_id%/%postname%/ 在自定义结构中导致404错误。

在阅读了一些文章后,我将其放在custom structure字段中,从而解决了这个问题;试用n错误:/index.php/blog/post/%post_id%/%postname%/ .

我使用nginx。

结束

相关推荐

old permalinks not found

通过Google网站管理员工具查看,我有很多404个永久链接结构为/%年%/%月%/%日%/%postname%的帖子/此后,我将永久链接更改为/%类别%/%postname%。html我原以为Wordpress可以将旧的帖子URL重定向到新的帖子URL,但旧的基于日期的URL正在生成404。我的htaccess文件可写,设置为644。为什么会发生这种情况?谢谢