Mod Rewrite Rule not matching certain words

Posted by Andy Gee on Stack Overflow See other posts from Stack Overflow or by Andy Gee
Published on 2012-03-24T05:26:24Z Indexed on 2012/03/24 5:29 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

I'm no expert in mod_rewrite at all and I'm trying to add a condition to the rule below to:

  1. match which is not equal to 'share'
  2. not match anything with a dot in it

RewriteRule ^([^/]*)$ http://domain.com/directory/index.php?key=$1 [L]

http://domain.com/directory/share will not be matched (share)

http://domain.com/directory/foo.php will not be matched (contains a dot)

http://domain.com/directory/abcde will be matched

http://domain.com/directory/abcde-4 will be matched

All ULRs will not have a trailing slash

Any help will be much appreciated

© Stack Overflow or respective owner

Related posts about php

Related posts about apache