RewriteRule重定向到index.php:找不到文件

时间:2016-06-23 14:06:15

标签: apache .htaccess mod-rewrite php-7 apache2.2

我已经在OSX El Captain上使用MacPorts安装了php70的apache2.2。

我在文件夹v3中有下一个.htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

当我进入http://localhost/~user/v3/version时,它会说The requested URL /Users/user/Sites/v3/index.php was not found on this server。我确信文件在那里。

顺便说一句,如果我使用http://localhost/~user/v3/index.php/version,一切正常。

/opt/local/apache2/conf/users/user.conf的内容:

<Directory "/Users/user/Sites/">
    DirectoryIndex index.php index.html
    Options Indexes MultiViews FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from localhost
    Require all granted
</Directory>

使用以前版本的php55,一切正常。可能导致这种情况的原因是什么?

修改

Apache error_log(多次出现):

[Fri Jun 24 12:52:36 2016] [error] [client ::1] File does not exist: /opt/local/apache2/htdocs/Users

而不是/opt/local/apache2/htdocs/Users它应该是/Users

编辑2: 我创建了一个指向/opt/local/apache2/htdocs/Users的符号链接/Users。丑陋的修复,但现在我进入apache access_log:

localhost - - [26/Jun/2016:12:29:04 -0300] "GET /~user/v3/version HTTP/1.1" 404 550

0 个答案:

没有答案