first of all, i try to find solution already in topics but didn't find something close to my problem so i decide to ask here. I'm beginner when comes to htacces and dynamic redirects, so i hope i will learn more about that from your help.
I need to redirect my old dynamic urls to new url format with 301 redirect in htaccess.
I have db with city list in format:
http://www.exampledomain.com/city/1_NewYork/
I want to change my urls to new format like example below:
http://www.exampledomain.com/1_NewYork/
I have more than 300 cities in database and i want to redirect old urls to new format with 301 redirect automatically , so i dont have to type manual 301 redirects in htaccess for every city.
Current Htaccess:
RewriteEngine On
RewriteRule ^city/([-]?[0-9]+)([-_][^/]*)? index.php?view=main&cityid=$1 [QSA]
Sorry for my English, i know its not the best :)
Thanks in advance.
You can use this rule as your very first rule before other rules: