I am busting my head against a wall. I have a created an updated version of a website, and I have various dynamic pages that are being fed through PHP. The old pages had the following rewrites on them through htaccess:
OLD URL BEFORE REWRITE:
/directorio_hoteles/ean/hotel.php?cou=$1&hn=$2&city2=$3
OLD URL AFTER REWRITE:
/directorio_hoteles/Mexico/hotel336813/Villa_Mercedes_Petit_Hotel.htm
HERE IS HOW IT WAS CODED IN THE ORIGINAL HTACCESS:
RewriteRule ^([^/]*)/hotel([^/]*)/([^/]*)\.htm$ ean/hotel.php?cou=$1&hn=$2&city2=$3 [L]
I understand that this original format was not the best way to accomplish this, but this is what I have to work with, and the dynamic url's are already indexed in google. So I need to take the above already rewritten url and redirect (301) it to the new dynamic format which is:
NEW URL BEFORE REWRITE:
directorio-hoteles/index.php?p=hotel-page&a=$1&b=$2&c=$3
NEW URL AFTER REWRITE:
directorio-hoteles/hotel/Mexico/Villa_Mercedes_Petit_Hotel/336813
HERE IS HOW IT IS CODED IN THE NEW HTACCESS FILE:
RewriteRule ^directorio-hoteles/hotel/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)?$ directorio-hoteles/index.php?p=hotel-page&a=$1&b=$2&c=$3 [NC,L]
So I can not wrap my head around how to get this:
/directorio_hoteles/Mexico/hotel336813/Villa_Mercedes_Petit_Hotel.htm
to redirect to this:
directorio-hoteles/hotel/Mexico/Villa_Mercedes_Petit_Hotel/336813
Any help would be BEYOND appreciated. Thank you in advance for any attempts to solve this issue.