嘿,这里是我有一个问题的例子。我有一个链接:url rewrite question
<a href='/index.php'>link</a>
这将反过来去domain.com/index.php
现在我怎么会让如此,与URL重写,它不index.html的后显示?
我知道我只能用“/”链接到文档根目录,但这不适用于所有情况。所以简单的重写会非常棒!
嘿,这里是我有一个问题的例子。我有一个链接:url rewrite question
<a href='/index.php'>link</a>
这将反过来去domain.com/index.php
现在我怎么会让如此,与URL重写,它不index.html的后显示?
我知道我只能用“/”链接到文档根目录,但这不适用于所有情况。所以简单的重写会非常棒!
RewriteEngine On
RewriteRule ^index.php$/[R=301,L]
OK,这是更优雅;-) – konsolenfreddy 2011-03-15 07:45:44
完美,谢谢! – smither 2011-03-15 07:54:29
你也可以强制,如果你不能影响链接像@Pekka建议
RewriteCond %{REQUEST_URI} ^/index\.php$
RewriteRule ^(.*)$ http://domain.com [R=301,NC,L]
不应该需要改写:只是链接到'domain.com' – 2011-03-15 07:41:35