我的用户目录下有一个 php/apache 网站,比如说http://localhost/~johnny5/
我有一个/en包含.htaccess文件和文件的index.php文件夹:
/home/johnny5/public_html
/somefile.php
/someotherfile.php
/en/
.htacces
index.php
我启用了 url 重写,/en因此所有请求都由 index.php 处理。这是 .htacces 的内容:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /~johnny5/en
RewriteRule . index.php
到这里为止,一切正常。
当我点击 时,http://localhost/~johnny5/en/foo/bar请求由 处理/en/index.php。
现在,出于测试目的,我将网站移到下面,/var/www这样我就可以直接通过http://localhost/. 我调整.htaccess文件以删除用户文件夹:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /en
RewriteRule . index.php
我现在有这个结构:
/var/www
/somefile.php
/someotherfile.php
/en/
.htacces
index.php
现在,如果我点击http://localhost/en/foo/bar,我希望请求由 处理/en/index.php,但我得到的只是 404 not found for /en/foo/bar。
看起来重写模块在我的用户目录下工作,但不在“主”目录下。
我错过了什么?