Reputation: 3839
My .htaccess look like as below
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^condos-([^-]*)-([^-]*)\.html$ /fm
/cond_new?r_id=$1&location=$2 [L]
The above URL is my old dynamic URL http://localhost/fm/condos-2-delhi.html
My new dynamic URL is http://localhost/fm/delhi/2/condos
and .htaccess has below pattern
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ /fm
/condo_new?location=$1&r_id=$2&name=$3 [L]
Now i want all URLs of pattern http://localhost/fm/condos-2-delhi.html
shall redirect to http://localhost/fm/delhi/2/flavor
with 301 redirect.
where flavor is name of product.
I tried as below but no success
RedirectMatch 301 ^condos-([^-]*)-([^-]*)\.html$ ^([^/.]+)/([^/.]+)
/([^/.]+)/?$
Upvotes: 1
Views: 231
Reputation: 786289
You can use this rule in /fm/.htaccess
:
RewriteRule ^(condos)-([^-]+)-([^-]+)\.html$ /fm/$3/$2/$1 [L,NC,R=301]
Make sure this is your first rule below RewriteEngine On
.
Upvotes: 1