修改固定链接后不能访问文章问题_访问时提示404错误
修改固定链接后不能访问文章问题,或者访问时提示404错误:
如果你的Apache、PHP、Mysql系统架构是自己配置的,或使用的某些安装包,可能会有这个问题,具体解决办法如下:
(1)Apache中的rewrite模块没有开启,在配置文件httpd.conf中去除这一行前面的#号就可以了
#LoadModule rewrite_module modules/mod_rewrite.so
变为:
LoadModule rewrite_module modules/mod_rewrite.so
(2)AllowOverride Not Enabled
服务器可能没打开AllowOverride。
如果Apache中配置文件httpd.config的AllowOverride设置的是None,那.htaccess将被忽略。
正确的设置:
Directory /
Options FollowSymLinks
AllowOverride All
# Order deny,allow
# Deny from all
/Directory
也需要在DocumentRoot打开AllowOverride:
Directory "D:/wamp/www/"
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
Options Indexes FollowSymLinks
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride all
# Controls who can get stuff from this server.
# onlineoffline tag - don't remove
# Order Allow,Deny
# Allow from all
/Directory
注意,以上修改完成后,要重启Apache才能生效。