龙岩易富通网络科技有限公司

龙岩小程序开发,龙岩分销系统

apache下htaccess不起作用,linux,windows详解

2015.09.12 | 1732阅读 | 0条评论 | 服务器配置

可能出现下面这三种的错误可能性: 

第一种:启用 rewrite 和 .htaccess 设置

rewrite设置:找到apache的配置文件httpd.conf文件,找到:#LoadModule rewrite_module modules/mod_rewrite.so去掉前面的#号。

改为:LoadModule rewrite_module modules/mod_rewrite.so

.htaccess设置

windows里面这样设置:AccessFileName htaccess  

linux里面这样设置:AccessFileName .htaccess。

linux比windows里面文件名前面多了一个点。如果没找到AccessFileName自己在httpd.conf文件最后面加上。

 

第二种:AllowOverride 的设置。

默认AllowOverride 为AllowOverride none。把这个改为:AllowOverride All。如果配置了多个虚拟目录需在每个目录里面开启,实例:

<VirtualHost *:80>
        DocumentRoot "D:SvnTracsvnSVNRepositorywwwroot"
        ServerName 127.0.0.1:80
 
        DirectoryIndex index.html index.htm index.php index.shtml
       <Directory "D:SvnTracsvnSVNRepositorywwwroot">
           Options Indexes FollowSymLinks
           AllowOverride ALL
           Order allow,deny
           Allow from all
       </Directory>
</VirtualHost>

<VirtualHost 127.0.0.2:80>
        DocumentRoot "D:/SvnTrac/svn/SVNRepository/www/"
        ServerName 127.0.0.2:80
 
        DirectoryIndex index.html index.htm index.php index.shtml
       <Directory "D:/SvnTrac/svn/SVNRepository/www/">
           Options Indexes FollowSymLinks
           AllowOverride ALL
           Order allow,deny
           Allow from all
       </Directory>
</VirtualHost>


赞 (

发表评论