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禁止错误.
So yesterday i installed Apache 2.2, PHP 5.3, and MySQL on my Windows 8 Machine. I am using the same vhost / .htaccess files on both but it works on my Mac and not Windows. Basically When i go to "mysite.dev" it renders the homepage of the site, but once i go to any page, such as "mysite.dev/about/" i get a 403 Forbidden Error.
我已验证Apache在我的计算机上以系统"身份运行,然后确保用户/组系统从站点文件夹到根目录的所有权限都设置为完全访问".
I have verified that Apache runs as "System" on my computer and then made sure all permissions from the site folder to root are set to Full Access for the user/group System.
我尝试了很多事情,无法弄清这一点及其令人讨厌.无论如何,我已经在所有设置/日志下面发布了.谢谢你.
I've tried many many things and cant figure this out and its rather annoying. Anyways i've posted below all of the settings / logs. Thanks in advanced.
虚拟主机:
<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文件中的以下内容
The solution was to change the following the in .htaccess file
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php/$1 [L]
到
RewriteRule ^(.*)$ index.php/$1 [L]
感谢@Svetlio的有用评论:)
Thanks @Svetlio for that useful comment :)
这篇关于Windows子目录上的Apache 403(禁止)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!