我've just started working with Apache, and ran into an odd issue with using RewriteRule to redirect users. I want to create a clean URL to link to an '关于'页面 . 我希望用户能够在地址栏中输入 mywebsite/about ,并在不更改地址栏的情况下定向到 mywebsite/a/b/about_files .

我将重定向规则放在Apache站点 config 文件(不是 .htaccess )中,并且以下工作正常,但更改了站点地址栏:

<VirtualHost *:80>
...

   DocumentRoot /var/www/html

   RewriteEngine on
   RewriteRule "^/about$" "/a/b/about_files" [R]

...
</VirtualHost>

从我发现的documentation,看起来我应该能够用 [PT] 替换 [R] 标志以保留 about 在地址栏中,但是当我这样做时,我只是得到一个 404 error . 用 [L] 或其他标志替换 [R] 也会产生 404 . 我没有找到任何有关此行为发生原因或如何修复的经过验证的建议......?

谢谢