2010-12-15 107 views
0

我试图建立一个mod_rewrite的,将做以下忽略最后一个目录,如果是第二个目录的mod_rewrite

www.mysite.com/dir/ignoreMe 
will map to 
www.mysite.com/dir 
however in the browser the url will still appear to be 
www.mysite.com/dir/ignoreMe 

if the url entered is simply 
www.mysite.com/dir 
the rewrite shouldn't do anything. 

这样我可以使用最后一个/第二目录,就好像它是一个GET查询字符串

回答

0
RewriteRule ^([^/]*)/([^/]+)$ /$1 
+0

RewriteRule ^([^/\。] +)/?$ index.php?marker = $ 1这就是我最终的结果。你的例子的一个变种。 – Mike 2010-12-16 18:14:42