zoukankan      html  css  js  c++  java
  • [转]apache下htaccess不起作用,linux,windows详解

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

    第一种:启用 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>

    第三种:Options 的设置

    默认设置是:Options Indexes FollowSymLinks
    如果改成以下设置后,就会出错
    Options Indexes FollowSymLinks MultiViews Includes (出错)
    如果要启用,目录浏览 MultiViews
    服务器端包含 Includes (<!–#include virtual=”top.htm” –>)

    为了简单可以设置为:Options All

     前两种是配置中常见的错误,第三种一般少见,最后提醒大家一下,记得配置文件改好后一定要重启服务器啊。有问题,留言,或收听微薄。

  • 相关阅读:
    学习:组件生命周期(2)
    学习:组件生命周期(3)
    学习:深入分析布局文件(HelloWorld)
    wap webapp app区别
    TCP的数据传输
    SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON 详解
    未能加载文件或程序集“SqlServerDal”或它的某一个依赖项。系统找不到指定的文件。
    人生的十个不要等
    asp.net网站三层架构详解和反射知识
    工厂模式概况
  • 原文地址:https://www.cnblogs.com/wuling129/p/4691292.html
Copyright © 2011-2022 走看看