apache - Redirect overwrites different rules in .htaccess -


i want redirect (301) 900 urls. made whole list, without errors, behaves string replace. take example line:

redirect    301 /assortiment/artikelen_ingedeeld_per_branche/transporteurs_verhuisbedrijven3/verhuisdekens____baal_a_25_stuks_.html?id=979 http://example.com/221-transport-en-verhuisbedrijven 

and there line:

redirect    301 /assortiment/   http://example.com/alle-producten 

when visit /assortiment/artikelen_ingedeeld_per_branche/transporteurs_verhuisbedrijven3/verhuisdekens____baal_a_25_stuks_.html?id=979 redirects /alle-productenartikelen_ingedeeld_per_branche/transporteurs_verhuisbedrijven3/verhuisdekens____baal_a_25_stuks_.html?id=979

notic assortiment --> alle-producten replacement @ beginning. if rewritten 'str_replace' see happening, don't understand .htaccess enough.

the first redirect nothing. can't put query string in redirect. second working intended. way redirect works, sort of "starts with" approach. if directive is:

redirect /a /b 

then:

  • /a redirect /b
  • /a/ redirect /b/
  • /abcd123 redirect /bbcd123
  • /a/b/c/d redirect /b/b/c/d

additionally, if rule is:

redirect /a/ /b 

then:

  • /a/ redirect /b
  • /a/b/c/d redirect /bb/c/d

etc.

if don't want happen, use redirect match:

redirectmatch ^/assortiment/$   http://example.com/alle-producten 

however, isn't going query string. neither redirect or redirectmatch match against query string. you'll need use mod_rewrite , rewrite rules:

rewriteengine on  rewritecond %{query_string} ^id=979$ rewriterule ^assortiment/artikelen_ingedeeld_per_branche/transporteurs_verhuisbedrijven3/verhuisdekens____baal_a_25_stuks_.html$ http://example.com/221-transport-en-verhuisbedrijven [l,r=301]  rewriterule ^assortiment/   http://example.com/alle-producten [l,r=301] 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -