Set redirect in .htaccess for all the urls with a suffix

I have the urls like:

http://example.com/vm-search/parentcategory-cityname/childcategory-cityname

They are indexed by search engines. I decided to remove the cityname suffix from all the parentcategories and now I need to set redirect from all the old urls to new ones before the search engines will index them. The citynames are the same for all the urls and the new urls will be like:

http://example.com/vm-search/parentcategory/childcategory-cityname

What code should I add to .htaccess?


Source: .htaccess

Leave a Reply