簡體   English   中英

Windows子目錄上的Apache 403(禁止)

[英]Apache 403 (Forbidden) on subdirectory on Windows

所以昨天我在Windows 8計算機上安裝了Apache 2.2,PHP 5.3和MySQL。 我在兩個文件上都使用了相同的vhost / .htaccess文件,但它在Mac和Windows上均無法使用。 基本上,當我轉到“ mysite.dev”時,它將呈現網站的主頁,但是一旦我轉到任何頁面,例如“ mysite.dev/about/”,我都會收到403禁止錯誤。

我已經驗證Apache在我的計算機上作為“系統”運行,然后確保從用戶文件夾到根目錄的所有權限都被設置為用戶/組系統的“完全訪問”。

我已經嘗試了很多事情,但無法弄清楚它,而且很煩人。 無論如何,我已經在所有設置/日志下面發布了。 提前致謝。

虛擬主機:

<VirtualHost *:80>
    ServerAdmin MyEmail@gmail.com
    DocumentRoot "C:/Users/Michael/Dropbox/Sites/onmytv"
    ServerName onmytv.dev
    ServerAlias www.onmytv.dev

    <Directory "C:/Users/Michael/Dropbox/Sites/onmytv">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order Deny,Allow
        Allow from all
    </Directory>
</VirtualHost>

的.htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php/$1 [L]

網頁上顯示的錯誤:

Forbidden

You don't have permission to access /C:/Users/Michael/Dropbox/Sites/onmytv/index.php/about/ on this server.

error.log中

[error] [client 127.0.0.1] (20023)The given path was above the root path: Cannot map GET /about/ HTTP/1.1 to file

access.log的

127.0.0.1 - - [02/Nov/2012:17:57:17 -0400] "GET /about/ HTTP/1.1" 403 256

解決方案是更改.htaccess文件中的以下內容

RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php/$1 [L]

RewriteRule ^(.*)$ index.php/$1 [L]

感謝@Svetlio提供有用的評論:)

用這個:

<VirtualHost *:80>
    ServerAdmin MyEmail@gmail.com
    DocumentRoot "C:/Users/Michael/Dropbox/Sites/onmytv"
    ServerName onmytv.dev
    ServerAlias www.onmytv.dev

    <Directory "C:/Users/Michael/Dropbox/Sites/onmytv">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order Deny,Allow
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM