Q:

redirect or route old url to new url

i have a website developed with codeigniter and now i have changed the url structure as below
old:
www.website.com/library/country/city/boot_title/book_id

new:
www.website.com/library/bookings/city/country/boot_title/book_id

 www.website.com/library/country/ - displays books country wise
 www.website.com/library/country/city/ - displays books city wise

currently there are about 1500 pages with around 100 countries.
what would be the most affective way to redirect or route the old url to the new one?

A:

Maybe this is what you are looking for:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/([\w]+)/([\w]+)/([\w]+)/([\w]+)/([\w]+)/?$
RewriteRule .*   %1/bookings/%3/%2/%4/%5     [L,R=301]

Redirects:
http://www.website.com/library/country/city/boot_title/book_id
To:
http:www.website.com/library/bookings/city/country/boot_title/book_id 

