mod rewrite - Refactoring a mod_rewrite depending if query string exisits -


rewritecond %{query_string} lang_opt\=e   rewriterule /lc/courses.asp english-resource [r=301,nc,l]  rewritecond %{query_string} lang_opt\=f   rewriterule /lc/courses.asp french-resource  [r=301,nc,l]  rewriterule /lc/courses.asp english-resource [r=301,nc,l] 

a link comes in 3 flavors
/lc/courses.asp
/lc/courses.asp?lang=e
/lc/courses.asp?lang=f

is there more elegant way deal these 3 variations of link. have quite few of them , 5 line of mod_rewite per seems excessive.

thanks

since english default, need french , redirect else english:

rewritecond %{query_string} lang_opt=f rewriterule ^/lc/courses\.asp$ french-resource  [r=301,nc,l] rewriterule ^/lc/courses\.asp$ english-resource [r=301,nc,l] 

Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -