(Easy) What is htaccess for Rewrite dynamics urls oldname-id.html to newname-id.html

I want to redirect Rewrite dynamics oldname-id.html to newname-id.html , because the file name is changed

The file name is changed
the id is dynamic numbers

for example

old urls

http://www.domain.com/country-origin-Irish-page-1.html
http://www.domain.com/country-origin-Irish-page-2.html
http://www.domain.com/country-origin-Irish-page-3.html
http://www.domain.com/country-origin-Irish-page-4.html
and so on

to new urls

http://www.domain/country-origin-Irlandia,_Ireland,_Irish-page-1.html
http://www.domain/country-origin-Irlandia,_Ireland,_Irish-page-2.html
http://www.domain/country-origin-Irlandia,_Ireland,_Irish-page-3.html
http://www.domain/country-origin-Irlandia,_Ireland,_Irish-page-4.html
and so on

Please help guys what is the right htaccess for this

Normally I don’t deal out freebies, but this one is quite easy.
Here ya go:


RewriteEngine On
RewriteRule ^country-origin-Irish-page-(\\d+)\\.html$ /country-origin-Irlandia,_Ireland,_Irish-page-$1.html

If you are on Apache 1.x change ^ to ^/
If you’re not sure whether you are Apache 1.x or 2.x change ^ to ^/?

:slight_smile:

Yes I know, but the “and so on” he typed suggested to me there are lots of URL’s, in which case I reckoned mod_rewrite would be faster :slight_smile:

ScallioXTX,

I already gave him that - in the tutorial linked in my signature AND which is in the sticky posts. Why, oh, why do we have to repeat EVERYTHING when someone won’t take the time to look. I hate spoonfeeding!

In addition, if basketmen only has the four URLs to change, mod_alias’ Redirect would be much faster (but only because it’s part of Apache’s core).

Regards,

DK