1.找到apache的安装目录,找到config/httpd.conf,找到DocumentRoot "D:/wamp/www/" 改成你想要的目录,例如:改成 DocumentRoot "F:/www/" 2.找到 <Directory "D:/wamp/www/"> 改成<Directory "F:/www/"> 此时本来应该能成功访问的,但是也可能会报这样的错: You don't have permission to access /index.php on this server. 这表示权限不够禁止访问啊!!! 于是,你需要在在此文件中找到类似这样的地方 <Directory /> AllowOverride none Require all denied </Directory> 改成 <Directory /> AllowOverride none allow from all </Directory> Require all denied就是因为这句话,请求都被拒绝了,然后你改成allow from all就可以啦~~