On Sun, Nov 22, 2009 at 5:40 AM, Daniel <dan...@timespace.com.au> wrote:
> I actually want to check if the last part contains a dot which would
> make it a file and then not redirect.
>
> http://www.mysite.com/something/more/whatever/ (should redirect)
> http://www.mysite.com/something/more/whatever (should redirect)
> http://www.mysite.com/something/more/whatever.gif (should NOT
> redirect)
> [...]
> The site I am working on has thousands of 'paths' so I don't want to
> code them all in to the redirect.
> I just need it to redirect and path that doesn't have a filename on
> the end.
How about:
<from>^(.*/[^./]*)$</from>
This will match:
- anything ending in a slash (.*/)
- anything ending in a slash with a trailing section that doesn't
contain dots or slashes [^./]
- will unfortunately also redirect if you have something like
/blah/dot.gif/ because of the trailing slash
I'm not entirely sure whether it's correct on sunday afternoon but it
looks sorta good to me. Might do a bit too much backtracking there but
that's hardly ever a problem.
regards,
Wim