I have a website with stories in it. I can have multiple types of stories within multiple categories like:
- children
- romance
- scifi
- action
- thriler
- quests
The stories are accessible using urls like:
www.example.com/action/story-name-action/
www.example.com/romance/story-name-romance/
and the first param (action) and the second (story-name-action) are redirected with .htaccess using rules. This part works just fine.
Lately, I get few dozen of 404 from different sites and here’s what I want to do but I dont know how:
If someone types, for example: /action/story-nme-ction, I want to redirect to: action/story-name-action/
Is there an efficient way to implement this?
Oh man, oh man!
What you’re asking for is not simple and need you to have a powerful computer, but the results are simply amazing.
Here’s what I’d suggest to do:
ErrorDocumentredirection in vhost configuration. Mine looks like this:ErrorDocument 404 /404.php;/404.phpwith all the arguments (which bad URL and so on, dump$_SERVERto see this). You have to test if there are only two expressions in the URL/i.e.http://mysite.com/(expr1)/(expr2)/404 Phpfile). See query sample here./action/story-name-action/? if so, click on the link”.This a hard work, but it’s both interesting and shows your skill. Very few websites do this (I just know google actually).
Here’s a demo on my French table that could give you an overview of how it works: