Simple regex question (php) -


i've been using line in routes file:

$route['^(?!home|members).*'] = "pages/view/$0";

the string in array on left of expression ( ^(?!home|members).* ) i'm trying figure out.

basically url not:

/home or /home/ or /members or /members/ should true. problem have if url /home-asdf. counts being in list of excluded urls (which in example has 'home' , 'members'.

ideas on how fix this?

try modification:

^(?!(home|members)([/?]|$)).* 

this filters out urls beginning home or members if names followed slash or question mark ([/?]), or end of string ($).


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -