URL Redirection Mayhem…

Following on from my website trials and tribulations with the new DD Metal Products site, I realised that changing websites three times in as many months is not a good idea. It leaves behind a trail of destruction – broken web links, missing pictures that were linked into from other sites – Facebook etc and other internet mess and dross.

I set about messing with WordPress plugins that created “301” redirects for the dreaded “404 Page Not Found” errors – this seemed easy – just monitor the 404 log and create a URL redirection wherever possible. Then I noticed a box marked “Regular Expression” in the redirect plugin, Google showed me this was a super-geeky way of using wild-card search matching (plus other stuff) so I thought lets use wild-cards for my old stock items and cut down the number of redirects big time!

I then set about and converted my list of redirects to what seems to be known “regex” codes and left it at that – a nice short 301 list, neat and tidy.

That was until I was testing some alterations to the layout of one of my pages titled “/tools”, this failed and I got a “This page is not redirecting correctly” error from the browser :( Luckily I realised what was happening – I had just entered a wild-card redirect for “tools” as this was used in one of my old sites too. This meant that my genuine page request for “/tools” was being matched by the search for “tools” and redirected recursively and endlessly until the browser gives up – about 30 seconds.

Removing the redirect fixed it instantly and a full site test revealed three other similar breakages.

The way round this would be to increase the pattern-match string to include more of the old site URL, or make sure that nothing on the new site has the same name as the old sites I guess.

Points of note…
It’s surprisingly easy to break a web site!
Make damn sure you think of the consequences before messing with redirection!
Leave the blasted computer alone and get back out in the workshop :)