修改 /etc/apache2/sites-enabled/000-default 文件
將DocumentRoot,與Directory 指向新路徑。如
DocumentRoot /home/terrence/project1/
<Directory /home/terrence/project1/>
# The Options directive is both complicated and important.
Options Indexes FollowSymLinks
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride None
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>
然後執行 sudo /etc/init.d/apache2 restart 重開
如果還是一直有問題,那想必是該目錄沒有執行的權限。
sudo chmod -R +x project1
切記。所有網頁連父目錄都要有執行的權限。