【发布时间】:2010-11-01 10:01:36
【问题描述】:
例如,我有一个寻找这样的图像的 URL:
http://example.com/img/foo.png
http://example.com/img/interface/menu/bar.png
http://example.com/static/users/avatars/small/3k5jd355swrx221.jpg
我不想重定向那些。他们应该只是通过。但是,我有这样的网址:
http://example.com/register/
http://example.com/my_account/my_picture/
http://example.com/contact/email/
所有此类不请求 .png 或 .jpeg 的 URL 都应重定向到:
其中 x 代表 example.com/ 之后的所有内容,因此在此示例中:
http://example.com/register/转
http://example.com/index.php/register/http://example.com/my_account/my_picture/转
http://example.com/index.php/my_account/my_picture/http://example.com/contact/email/转
http://example.com/index.php/contact/email/
(AcceptPathInfo 已启用)
.htaccess 中有没有办法做到这一点?我只知道如果我总是有http://example.com/someKindOfMarkerHere/stuff/stuff/stuff 之类的东西我怎么能做到这一点,但我不想让 someKindOfMarker 在那里检测它是否是一个必须重写的 URL。我不知道如何排除它们。
【问题讨论】:
标签: php .htaccess mod-rewrite