初学php,使用xampp作为开发环境,
根目录是htdocs,我更换为自己的工作目录,但是怎么设置apache以便访问并设置xampp呢,请教了。

解决方案 »

  1.   

    修改etc目录下httpd.conf.template文件中的DocumentRoot后面的路径
    然后重启xampp即可
      

  2.   

    我是windows下的xampp,没有etc目录
      

  3.   

    在xampp目录下点击搜索,肯定能搜索出httpd.conf这个文件然后修改DocumentRoot这个路径就可以了
      

  4.   


    就在xampp目录下就有etc目录啊
      

  5.   

    xampp\apache\conf
    在这个目录下有httpd.conf这个文件,打开,在180左右找到:
    DocumentRoot "C:/xampp/htdocs"
    修改它就可以了
      

  6.   

    没有说清楚,
    我想大家都误会意思了,
    这样说吧,就是开发环境是在一个目录 f:\xampp\htdocs\work下,
    原来根目录是f:\xampp\htdocs,我现在改为 f:\xampp\htdocs\work,
    现在http://localhost/访问work目录,
    但是我想设置例外一个路径去访问htdocs,以设置xampp,我试了虚拟主机,但是没有成功,
    想问大家,使用 xampp作为开发环境的同学们,怎么处理这两个要求的。
      

  7.   

    可能楼主虚拟目录设置不正确。
    本机情况:
    开发目录:c:\xampp\htdocs\fundi,于是把根目录修改到这个目录下,使用localhost访问。
    再设置虚拟目录main,现在使用localhost/main可以访问到c:\xampp\htdocs\,完全没有问题
    不知道是否和楼主相同?下面是httpd.conf文件设置DocumentRoot "C:/xampp/htdocs/fundi"#
    # Each directory to which Apache has access can be configured with respect
    # to which services and features are allowed and/or disabled in that
    # directory (and its subdirectories). 
    #
    # First, we configure the "default" to be a very restrictive set of 
    # features.  
    #
    Alias /main "C:/xampp/htdocs"
    <Directory "C:\xampp\htdocs">
    Order allow,deny
    Allow from all
    </Directory>
      

  8.   

    我按照你的方法设置了虚拟目录,
    http://localhost/main/ 说拒绝访问,
    http://localhost/main/index.php 也是
      

  9.   

    前天我放在F盘的DZ文件夹也出问题了…结果发现因为F盘是NTFS,所以要重新设置权限;C盘是FAT32所以没出现这个问题…
    唔…不过这种错误也只有我会犯吧- -||
    但是 拒绝访问 通常都是权限问题呢…
    DocumentRoot "C:/xampp/htdocs/"
    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>Alias /bbs "F:/DZ" 
    <Directory "F:\DZ"> 
    Order allow,deny 
    Allow from all 
    </Directory>
      

  10.   


    你说的很可能,我是win2003,文件系统全部是ntfs,
    希望不是你说的原因,除了更改文件系统,应该还有别的办法吧,
    权限设置,我把文件夹设置为共享了,也还是拒绝访问,
      

  11.   

    除了共享还有文件权限,在03域环境下再检查下NTFS权限?- -
    Access forbidden!
    You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. If you think this is a server error, please contact the webmaster.