Skip to content Skip to sidebar Skip to footer

How To Redirect Multiple Similar Urls With One Query?

I currently have lots of URLs that look like this: http://www.domain.com/classes-dallas-tx.html I need to change all URLs to the following: http://www.domain.com/classes-in-dallas-

Solution 1:

Try:

RedirectMatch 301 ^/([^-]+)-([^-]+)-([^-]{2})\.html$ /$1-in-$2-$3.html

Or

RewriteEngine On
RewriteRule ^/?([^-]+)-([^-]+)-([^-]{2})\.html$ /$1-in-$2-$3.html [L,R=301]

in the htaccess file in your document root.

Post a Comment for "How To Redirect Multiple Similar Urls With One Query?"