regex - .htaccess instead a range use 2 options -
i have code in .htaccess
file:
options +symlinksifownermatch rewriteengine on # turn on rewriting engine rewriterule ^([a-z]+)/([a-z]+)?$ index.php?lang=$1&loc=$2 [nc,l] rewriterule ^([a-z]+)/([a-z]+)/restaurants/?$ all_rest.php?lang=$1&loc=$2 [nc,l]
as can see, variables lang
, loc
can in range ([a-z]+)
dont need total range need words: en
or chin
lang
variable , hk
or kw
loc
variable.
i have tried this:
rewriterule ^([en][chin])/([hk][kw])/restaurants/?$ all_rest.php?lang=$1&loc=$2 [nc,l]
but dont know why works hk kw
y no para en chin
.
any idea?
you using character sets, match individual characters. so, [hk][kw]
match these: hk, hw, kk, kw
. want this:
rewriterule ^(en|chin)/(hk|kw)/?$ index.php?lang=$1&loc=$2 [nc,l] rewriterule ^(en|chin)/(hk|kw)/restaurants/?$ all_rest.php?lang=$1&loc=$2 [nc,l]
Comments
Post a Comment