2012-11-02 73 views
0

因此,昨天我在Windows 8計算機上安裝了Apache 2.2,PHP 5.3和MySQL。我在兩個版本上都使用了相同的vhost/.htaccess文件,但它適用於我的Mac而不是Windows。基本上,當我去「mysite.dev」它呈現網站的主頁,但一旦我去任何頁面,如「mysite.dev/about/」我得到一個403禁止錯誤。Windows上子目錄上的Apache 403(Forbidden)

我已驗證Apache在我的計算機上作爲「系統」運行,然後確保從站點文件夾到root的所有權限都設置爲用戶/組系統的完全訪問權限。

我已經嘗試了很多很多事情,並且無法弄清楚它的相當煩人。無論如何,我已經發布了所有的設置/日誌。先謝謝了。

虛擬主機:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    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 
+1

重寫規則^ $的index.php/$ 1 [L]你可以在你的最後重寫線 – Svetoslav

+0

試試這個(*)? mod_rewrite是否被編譯? – frustratedtech

+0

是Mod_rewrite在:) –

回答

3

的解決方案是改變下列中.htaccess文件

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

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

感謝@Svetlio爲有用的評論:)

2

使用此:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    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> 
+1

這個解決方案適用於我,當我遇到同樣的問題 – Bill