对目录后的所有请求进行mod重写


mod rewrite for all requests after a directory

我想重写url中目录后的所有请求,但我一辈子都想不出该怎么做。

本质上寻找:

url.com/directory/anything/after/the/directory/

因此,如果有任何请求com到url.com/directory/,不管它被重定向回目录(即url.com)之前的索引后会发生什么,

我尝试使用正则表达式模式:/forex/。?(.*)

但我真的没有进展。

有人能把我踢向正确的方向吗。我基本上是为了:

RewriteRule '/forex'/.?(.*) inxe.php

但这并没有奏效。

感谢所有回复,谢谢!

在执行任何规则之前,请确保在上编写"重写引擎"

尝试:

RewriteRule ^/?dir/((?!index).+)$ /index.php [NC,L,QSA]

这将重定向

  • /dir/foo/bar(不包括目录索引文件)

  • /index.php