civilvar 发表于 2015-11-16 14:25:39

wamp5的www目录如何更改

主要过程:
         (1)修改httpd.conf文件
         (2)修改新的www目录下的index.php文件
         (3)修改manage.ini的278行和manage.tpl的125行

我的WAMP2.0安装在E盘在,所以我的www目录是e:/wamp/www/,我想将它改为g:/www/
第一步:修改Apache-->httpd.conf文件
DocumentRoot "e:/wamp/www/"   改为DocumentRoot "g:/www/"
<Directory &quot;e:/wamp/www/&quot;>   改为<Directory &quot;g:/www/&quot;>
保存,重启WAMP,但是并没有达到我们想要的结果,http://localhost/是改了,但是我想要正常安装后的首页是显示版本信息的,那么把原来/wamp/www/中的index.php文件复制到g:/www/下。
         
第二步:修改g:/www/下的index.php文件,看第11到15行:
//chemin jusqu'au fichier de conf de WampServer
$wampConfFile = '../wampmanager.conf';
//chemin jusqu'aux fichiers alias
$aliasDir = '../alias/';
把配置文件和虚拟目录的路径改正过来,就是将原来的相对路径改为绝对路径:
//chemin jusqu'au fichier de conf de WampServer
$wampConfFile = 'e:/wamp/wampmanager.conf';
//chemin jusqu'aux fichiers alias
$aliasDir = 'e:/wamp/alias/';
这样就可以正常了,重启WAMP打开http://localhost/看到的就和你平时看到的一样了。如果你不需要这个首页了,想自己做个首页,或只放一个网站来玩,这步可以不要。

但效果仍然不完美,http://localhost/的问题是解决了,但点了右下角的图标,菜单里有个“www 目录”,点了之后打开的仍然是e:/wamp/www/,想改成g:/www的往下看
         
第三步:改菜单中的“www 目录”指向
         
打开安装目录e:/wamp/wampmanage.ini,278行。
Type: item; Caption: &quot;www 目录&quot;; Action: shellexecute; FileName: &quot;e:/wamp/www/&quot;; Glyph: 2
把 e:/wamp/www/改成g:/www/,
e:/wamp/wampmanage.tpl,125行:
type: item; Caption: &quot;${w_wwwDirectory}&quot;; Action: shellexecute; FileName: &quot;g:/www/&quot;; Glyph: 2

保存文件,退出WAMP,再重新打开一点菜单中的“www 目录”,打开了g:/www/,终于成功了!!!!
         
随后你可以更改eclipse的工作空间:file--->Switch Workspace 为:g:/www
我已亲身实践将工作目录改为d:/work/
出处:http://hi.baidu.com/yyzz990/item/f5a892c2e05f5d300831c64a
页: [1]
查看完整版本: wamp5的www目录如何更改