重定向的一切,这不是一个负面的形象重写规则?

问题描述:

我想创建一个重定向的家居一个Apache重写规则不图像文件到一个特定的脚本,但我已经无法使其与^和负向前看符号工作。基本上以下之一匹配,如果它的的形象,但我不知道如何使它负。

I'm trying to create an Apache rewrite rule that redirects everything that is not an image file to a specific script, but I've been unable to make it work with ^ and negative lookaheads. Basically the following one matches if it is an image, but I am not sure how to make it negative.

RewriteCond %{REQUEST_FILENAME} (.*\.(png|bmp|jpg|gif))$
RewriteRule .* ./not-an-image.php

任何帮助吗?谢谢!

Any help? Thanks!

只需使用,使之成为扭转比赛。

Just use a ! to make it a reverse the match.

RewriteCond %{REQUEST_FILENAME} !(.*\.(png|bmp|jpg|gif))$