.htaccess - Moving from IIS ISAPI rewrite to Apache mod_rewrite -
i've seen few people have asked on here already, none of solutions provided worked me far.
we have been developing iis isapi rewrite (on windows) , 1 of clients decided place project on linux server running apache. result of rules no longer working.
example of isapi rewrite rule:
rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^login/?([^/]*)([^/]*)$ /login.cfm?msg=$1&$2 [l,qsa] rewriterule ^login.cfm$ /login/ [r=301,l,nc]
login.cfm actual existing page , not dynamically generated based on template.
could me how translate apache mod_rewrite please? rule creates infinitive loop , output is:
login/?msg=&&msg=&&msg=&&msg=&&msg=&&msg... (till limit of url length)
safe page not found either doesn't check whether file such name exists.
the page /login or /login/wrong rule should recognize both cases.
you can use these rules in site root .htaccess:
rewriteengine on # external redirect actual url pretty 1 rewritecond %{the_request} /login\.cfm\?msg=([^\s&]*)\s [nc] rewriterule ^ /login/%1? [r=301,l,ne] # internal forward pretty url actual 1 rewriterule ^login(?:/([\w-]+))?/?$ login.cfm?msg=$1 [l,qsa,nc]
Comments
Post a Comment