htaccess不起作用的解決方法,AllowOverride All打開后出現403錯誤時解決辦法


 

在php程序的目錄下有一個htaccess文件,這個文件起着對url重寫的作用,但是不巧的,在我的應用程序里不起作用,baidu了一下,發現是

AllowOverride All,  這個選項沒有打開,

這個選項,只能寫在

<Directory />

</Directory>中,我在http.conf中打開了這個選項,結果網站出現了403禁止訪問的錯誤,經查看,結果發現是

 

<Directory />
Options Indexes
AllowOverride None
#AllowOverride All
Order allow,deny
Allow from all
</Directory>

不應在/這個目錄下,寫這個選項,應在應用程序的目錄下打開這個選項,

 

 

<Directory "http://www.cnblogs.com/WebRoot/Default"> 這里的相對目錄是對於配置文件中的ServerRoot而言.
 
#
# 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.0/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.
#
    Order allow,deny
    Allow from all
 
</Directory>

 如果打開了這個選項,還不起作用,那么就得檢查一下httpd.conf中打開了rewrite選項了沒有

LoadModule rewrite_module modules/mod_rewrite.so


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM