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
Post a Comment