最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】本地测试wordpress虽能打开主页但帖子打不开:Not Found The requested URL xxx was not found on this server

WordPress crifan 13736浏览 0评论

【背景】

折腾:

【记录】本地测试在线导出的wordpress是否正常工作

期间,虽然已经可以打开主页了,没有404错误了:

【已解决】本地测试网站搬家备份到本地的wordpress,打开主页却出现404错误

但是点击任意帖子,都还是会出错:

Not Found

The requested URL /crifan_com_online/boc_dollar_money_convert_to_renminbi_yuan_through_online_bank/ was not found on this server.

所以,看来还是没解决固定链接跳转的问题。

【解决过程】

1. 然后这次再去wordpress后台,设置一下固定链接试试:

结果发现,其默认变成了:

固定链接,是,文章名

permalink now setting is article name

所以去改为:

自定义结构: /%postname%/

change permalink to custom structure

结果虽然保存更改了,但是页面刷新后,看到的配置,却又是变成原先的 文章名 了。

另外,重启wamp后,也还是这个配置:文章名,

即,之前的改变为 自定义的动作,无效了。

2.参考:

wordpress固定链接修改之后不能访问的解决办法

然后去看看apache的mod_rewrite

结果从wamp的菜单中,没有找到apache又mod_rewrite

wamp apache not found mod rewrite

所以只能去看对应的配置文件

E:\dev_install_root\wamp_x64\bin\apache\apache2.2.22\conf\httpd.conf

to see the apache httd conf

果然原先是被注释掉的:

#LoadModule rewrite_module modules/mod_rewrite.so

所以去改为:

#LoadModule rewrite_module modules/mod_rewrite.so

3. 重启apache,即wamp,但是结果还是找不到mod_rewrite。

后来才发现,原来在apache modules中,叫做

rewrite_module

in apache name is rewrite module

然后打开,开启此模块。

4. 另外,再去处理AllowOverride

即,权限问题:

再把:

E:\dev_install_root\wamp_x64\bin\apache\apache2.2.22\conf\httpd.conf

中的:

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

改为:

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>

再重启wamp

然后,随便打开某个帖子,比如:

http://localhost/crifan_com_online/docbook_pdf_add_frame_for_each_page/

都可以正常打开了:

any post can open normally

5.不过,最后,觉得还是很诡异的是:

wordpress后台,把固定链接的设置,从:

文章名

permalink is artile name

改为:

自定义结构

change permalink from article name to custom

 

结果虽然显示更改成功,但是结果显示出来的选择,还是 文章名。。。。

但是不管了,暂时是整个本地的wordpress,算是工作正常了。

等有空再折腾了。。。

不过突然想起来了,貌似上述的:

文章名

自定义的 /%postname%/

貌似本身就是一样的效果。所以才会即使设置为

自定义的 /%postname%/

也自动变为 文章名 吧。

 

【总结】

解决wordpress能打开(无404),但帖子无法打开的办法是:

在固定链接本身设置为 /%postname%/,即文章名的前提下:

1.确保apache的mod_rewrite是开启了。

即httpd.conf中,取消注释,已变成:

#LoadModule rewrite_module
modules/mod_rewrite.so

2.确保有权限可以重写url

即httpd.conf中的

<Directory />

的AllowOverride从None变成了All:

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>

即可。

转载请注明:在路上 » 【已解决】本地测试wordpress虽能打开主页但帖子打不开:Not Found The requested URL xxx was not found on this server

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (8)

  1. 你这个方法真管用!我本地用的apmserv也是这个情况,主页可打开,内容也打不开,修改了你说的那个地方,就可以打开了!!感谢!
    李想7年前 (2017-01-07)回复
  2. 按照你的做法试了一次,帖子可以正常打开,可是后台就打不开,有什么办法可以解决?
    Andy9年前 (2015-03-16)回复
  3. 刚刚遇到这个问题,,重新设置下固定链接就可以了,谢谢!!
    www.uol123.com9年前 (2014-11-25)回复
  4. 谢谢啦,我的问题成功解决啦,非常感谢,真的非常感谢
    Adrift10年前 (2014-10-23)回复
  5. 我的虫草坊网站没有楼主说的这些文件,可能是由于空间服务商的原因。
    虫草坊10年前 (2014-10-20)回复
86 queries in 0.172 seconds, using 22.17MB memory