如果你的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才會生效。