zen_mind
zen_mind

Reputation: 59

301 redirect in .htaccess redirecting to incorrect page

I am trying to redirect an old page /home/samples.html that no longer exists to the new home page /

I have written the redirect as: Redirect 301 /home/samples.html /

However when I visit the old page I am redirected to /non-slip-mats-anti-slip-placematssamples.html

Could this be due to a conflict with another redirect? The others that I have written are below:

  Redirect 301 /front-page /
  Redirect 301 /content/mats /non-slip-mats-anti-slip-placemats
  Redirect 301 /content/netting /non-slip-netting
  Redirect 301 /content/self-adhesive-dycem /non-slip-self-adhesive
  Redirect 301 /content/bottle-openers /bottle-openers
  Redirect 301 /content/jar-openers /jar-openers
  Redirect 301 /content/cello-mats /cello-mats
  Redirect 301 /content/coasters /non-slip-coasters
  Redirect 301 /content/product-care /product-care
  Redirect 301 /content/cup-holder /cup-holder
  Redirect 301 /content/reels /reels
  Redirect 301 /content/floor-mats /floor-mats
  Redirect 301 /content/promotional-items /promotional-items
  Redirect 301 /babies.php /
  Redirect 301 /hippomats.php /non-slip-mats-anti-slip-placemats
  Redirect 301 /reels.php /reels
  Redirect 301 /netting.php /non-slip-netting
  Redirect 301 /jaropener.php /jar-openers
  Redirect 301 /catering.php /catering
  Redirect 301 /bottleopener.php /bottle-openers
  Redirect 301 /mats.php /non-slip-mats-anti-slip-placemats
  Redirect 301 /coasters.php /non-slip-coasters
  Redirect 301 /home.php /
  Redirect 301 /panels.php /non-slip-self-adhesive
  Redirect 301 /floormat.php /floor-mats
  Redirect 301 /music.php /music
  Redirect 301 /content/occupational-therapy /occupational-therapy
  Redirect 301 /pdf/ot.pdf /occupational-therapy
  Redirect 301 /trayliner.php /non-slip-mats-anti-slip-placemats
  Redirect 301 /cupholder.php /cup-holder
  Redirect 301 /rehab.php /occupational-therapy
  Redirect 301 /healthcare/index.php /
  Redirect 301 /customersample.php /
  Redirect 301 /usage.php /
  Redirect 301 /home/reels.php /reels
  Redirect 301 /home/music.php /music
  Redirect 301 /discs.php /non-slip-self-adhesive
  Redirect 301 /furnituredisc.php /non-slip-self-adhesive
  Redirect 301 /promo.php /promotional-items
  Redirect 301 /prodgeneral.html /
  Redirect 301 /vat/VAT.php /
  Redirect 301 /vat/vat.doc /
  Redirect 301 /home/samples.html /
  Redirect 301 /home /non-slip-mats-anti-slip-placemats 

Upvotes: 1

Views: 70

Answers (1)

anubhava
anubhava

Reputation: 784938

That is because of conflicting redirects in these 2 rules:

Redirect 301 /home/samples.html /
Redirect 301 /home /non-slip-mats-anti-slip-placemats 

You can see that /home also matches /home/samples.html URI. You would be better off using RedirectMatch for it's regex capabilities. So use these rules:

RedirectMatch 301 ^/home/samples\.html$ /
RedirectMatch 301 ^/home/?$ /non-slip-mats-anti-slip-placemats 

Likewise you can convert all your 301 rules to use RedirectMatch.

Upvotes: 1

Related Questions