I really need some help redirecting dirty URLs to clean ones.
Dirty URL: creature.php?beast=
Clean URL: /mythical-creature/
Currently my .htaccess looks like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mythicalcreatureslist.com [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^www.mythbeasts.com [NC]
RewriteRule ^(.*)$ http://www.mythicalcreatureslist.com/$1 [L,R=301]
RewriteRule ^menu/([A-Za-z0-9-+]+)/?$ menu.php?menu=$1 [NC,L]
RewriteRule ^menu_two/([A-Za-z0-9-+]+)/?$ menu_two.php?menu=$1 [NC,L]
RewriteRule ^mythical-creature/([A-Za-z0-9-+\'%]+)/?$ creature.php?beast=$1 [NC,L]
What this does is it makes the website show clean URLs when browsing which is great. However the old dirty URLs do not redirect when typed in the URL bar.
Example: Mongolian Death Worm http://www.mythicalcreatureslist.com/creature.php?beast=Mongolian+Death+Worm
I want it to redirect to: http://www.mythicalcreatureslist.com/mythical-creature/Mongolian+Death+Worm
This is causing duplicate content. I have tried:
RewriteRule ^/mythical-creature/([A-Za-z0-9-+\'%]+)/?$ http://www.mythicalcreatureslist.com/creature.php?beast=$1 [R=301,NC,L]
But what that did was to cause the dirty one to be used all the time.
I then flipped it round:
RewriteRule ^creature.php?beast=([A-Za-z0-9-+\'%]+)/?$ http://www.mythicalcreatureslist.com/mythical-creature/$1 [R=301,NC,L]
But that just caused 404s whilst browsing and still did not redirect the old dirty URLs when typed in the address bar.