apache - Mod_rewrite (htaccess) QSA and removing charactes from appended query string -
i've been struggling htaccess redirects. spent time reading , searching , couldn't solution works scenario.
i'm in process of making 301 redirect old website (asp) new 1 (wordpress). old pages has parameters query need process remove 'http://' string redirect work.
example url (old) redirect looks like:
http://www.domain.org/index.asp?documentid=2410&utm_source=it+travel+reminder&utm_medium=informz%2fnetforum&utm_campaign=it%2ftravel+reminder%2fmonthly+monthly+travel+reminder&zbrandid=4050&zidtype=ch&zid=28841368&zsubscriberid=1036792259&zbdom=http://my.informz.net
redirected to:
http://www.domain.org/permalink-2410/?qs=true&utm_source=it+travel+reminder&utm_medium=informz%2fnetforum&utm_campaign=it%2ftravel+reminder%2fmonthly+monthly+travel+reminder&zbrandid=4050&zidtype=ch&zid=28841368&zsubscriberid=1036792259&zbdom=my.informz.net
and .htaccess code redirect it:
rewritecond %{query_string} ^documentid=2410(&.*)$ [nc] rewriterule ^index\.asp(.*):(.*)$ http://www.domain.org/permalink/?qs=true%1%2 [l,r=301,qsa]
but somehow not working have expected when
rewritecond %{query_string} ^documentid=2410(&.*)$ [nc] rewriterule ^index\.asp$ http://www.domain.org/permalink/?qs=true%1 [l,r=301,qsa]
works fine when remove http://
or :
query string.
where have made mistake?
thanks!
try rule:
rewritecond %{query_string} ^documentid=(\d+)(&.+?)http://(.+)$ [nc] rewriterule ^index\.asp$ http://www.domain.org/permalink-%1/?qs=true%2%3 [l,r=302,nc,ne]
make sure clear browser cache before testing this.
Comments
Post a Comment