regex - How to add a rewrite condition to only pass URL's with one folder depth? -


i have rewrite rule needs applied urls go no further in depth 1 folder

example.com/a  >> rewrite me 

and not

example.com/a/b  >> don't rewrite me 

so need rewrite urls depth of 1. greater depth allowed needs go through unaltered.

how doing mod_rewrite condition statement? , can have personal rewrite rule written. thank you!

rewriteengine on  # matches urls equal to: "", "<text>", or "<text>/" # if matches, rewrite engine not attempt match more patterns rewriterule ^[^/]*/?$ - [l]  # if above doesn't match, meaning it's depth more one, # forbids content being delivered rewriterule .* - [f] 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -