rewrite asp to php based on asp query -
i have seen several questions similar , tried solutions @ loss. need redirect
example.com/products.asp?lob=health
to
example.com/services/healthcare/
i need several lob=different value. there way can redirect each url. maybe kind of rewrite condition on lob if value of lob = health, redirect here. if equals home, redirect somewhere else?
not sure "correct" way works.
rewritecond %{query_string} ^lob=value1$ [nc] rewriterule ^products.asp$ http://example.org/sample/one/? [r=301,l]
and different value:
rewritecond %{query_string} ^lob=value2$ [nc] rewriterule ^products.asp$ http://example.org/sample/two/? [r=301,l]
and doesn't match value:
rewriterule ^products\.asp$ [insert new url here] [r=301,l]
the last example works if want redirect .asp url .php. keep in mind have other conditions , rules removing .php extension , adding / files:
rewritecond %{request_filename} !-f rewriterule ^([^/]+)/$ $1.php rewriterule ^([^/]+)/([^/]+)/$ /$1/$2.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/)$ rewriterule (.*)$ /$1/ [r=301,l]
Comments
Post a Comment