XAMPP提示 Access forbidden情況的處理
阿新 • • 發佈:2019-01-07
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.
Error 403
test.abc.netApache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
當前的站點是定義在httpd-vhost.conf裡的,
<VirtualHost *:8080> ServerAdmin [email protected] DocumentRoot "D:/Documents/abc/php/basic/web" ServerName youai1.cm ErrorLog "logs/abc.net-error.log" CustomLog "logs/dummy-abc.net-access.log" common <Directory "D:/Documents/abc/php/basic/web"> RewriteEngine on # 如果請求的是真實存在的檔案或目錄,直接訪問 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # 如果請求的不是真實檔案或目錄,分發請求至 index.php RewriteRule . index.php </Directory> </VirtualHost>
這時在httpd.conf需要加上這一段程式碼:
<Directory "D:/Documents/abc/php/basic/web">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
或在上面的VirtualHost里加上這一段,
然後重啟xampp,問題解決。