Regex match this OR that?
Apache mod_rewrite does support negation, according to this document.
In mod_rewrite, the NOT character ('!') is also available as a possible pattern prefix. This enables you to negate a pattern; to say, for instance: ``if the current URL does NOT match this pattern''. This can be used for exceptional cases, where it is easier to match the negative pattern, or as a last default rule.
So you should be able to do something like:
!^(.*?/.*|.*?\.(?:php|html)$)$
And that should match anything which does not contain / and does not end in .php or .html
It's a whole lot easier to do positive matches in regex than negative matches. Try searching for ends in .php OR ends in .html OR contains /
and reverse the logic in your program.
With strict regular expressions, there isn't a general way to negate a given expression. With PCRE's you have the advantage of negative look-aheads, which significantly simplify the process of constructing a negated search, at the expense of performance.
^([^/]*\.(?!html$|php$)[^./]*)|[^/.]$
Use this regex -
(.*\.php$)|(.*\.html$)|(.*\/.*)