.htaccess - 301 Redirects problem - urls with ? and = -
.htaccess - 301 Redirects problem - urls with ? and = -
i'm new 301 redirects through .htacces.
i can simple redirects
redirect 301 /test.html http://www.domain.com/test2.html
to work have urls this
redirect 301 /test.asp?group=100 http://www.domain.com/test3.html
and reason these don't work.
thanks.
here set of rules urls have provided:
rewriteengine on rewritebase / rewritecond %{query_string} =group=113 [nc] rewriterule ^group\.asp$ http://domain.dk/til-born.htm? [nc,r=301,l] rewritecond %{query_string} =product=1136 [nc] rewriterule ^product\.asp$ http://www.domain.dk/til-born/bukser.html? [nc,r=301,l]
as can see query string matched separately page name. .. each of such redirects need 2 lines: rewritecond & rewriterule.
the rule above exact match, means /group.asp?group=113¶m=value
not redirected because query string group=113¶m=value
more group=113
.
to have such redirect working (when there optional parameters in query string) have modify it: rewritecond %{query_string} (^|&)group=113(&|$) [nc]
-- match group=133
anywhere in query string (group=113
, group=11366
still different, no problems here).
this needs placed in .htaccess in website root folder. if placed elsewhere tweaking may required.
.htaccess redirect http-status-code-301
Comments
Post a Comment