我有一个目录名为美元其中包含一个文件index.php。我想要的网址http://localhost/dollars/foo转换为dollars/index.php?dollars = foo。这是我现在有在美元 directorty .htaccess文件:.htaccess重写防止无限循环的规则
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !^index\.php
RewriteRule ^(.+)$ index.php?dollars=$1 [L]
的想法是不是的index.php的请求之外的任何请求,应使用重写规则。
但是,这不起作用。
我一直在寻找一段时间试图找出如何创建我想要的重定向,但我甚至不知道我是否在正确的轨道上。正则表达式从来不是我的东西。谢谢你的帮助!
这正是我所需要的。完善!非常感谢。 但是,我对以下问题有些困惑,尽管它并没有真正影响我。 url localhost/dollars/index重定向到index.php,而不传递'index'作为$ 1参数。为什么是这样? 再次感谢! – apeace 2010-06-25 16:34:25