有不少朋友會發現在使用wordpress博客時修改固定鏈接后不能訪問文章問題,或者訪問時提示404錯誤提示了,這個就是頁面不存在了,也就是rewrite功能沒配置好了,我們只要按下文章設置即可解決.
如果你的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才能生效.
新聞熱點
疑難解答
圖片精選