【发布时间】:2011-03-08 01:40:04
【问题描述】:
我有一个名为 dollars 的目录,其中包含一个文件 index.php。我希望将网址 http://localhost/dollars/foo 转换为 dollars/index.php?dollars=foo。这是我目前在 dollars 目录中的 .htaccess 文件:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !^index\.php
RewriteRule ^(.+)$ index.php?dollars=$1 [L]
这个想法是除了对 index.php 的请求之外的任何请求都应该使用 RewriteRule。
但是,这不起作用。
我一直在寻找一段时间,试图弄清楚如何创建我想要的重定向,但我什至不知道我是否走在正确的轨道上。正则表达式从来都不是我的事。感谢您的帮助!
【问题讨论】:
标签: regex apache .htaccess mod-rewrite apache2