Reputation: 51
I'm trying to to change some URL formats for good while want to exclude some URLs:
myurl.come/usa/(.*)
---> myurl.come/usa/(.*)+2014
while myurl.come/usa/music-events/
will stay the same.
This is what I need but don't know how to write it properly:
RewriteCond %{REQUEST_URI}!^usa/music-events [AND]
RewriteCond %{REQUEST_URI} usa/(.*)
RewriteRule ^usa/(.*) /usa/Concat($1,2014 ) [R=301,L]
Upvotes: 1
Views: 682
Reputation: 785186
This one-liner rule should work for you:
RewriteEngine On
RewriteRule ^(usa)/((?!(?:music-events|2014)).+)$ /$1/$22014 [R=301,L,NC]
Upvotes: 1
Reputation: 12469
This should work:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/usa/music-events
RewriteCond %{REQUEST_URI} !^/usa/(.*)-2014
RewriteCond %{REQUEST_URI} ^/usa/(.*)
RewriteRule ^usa/(.*)$ /usa/$1-2014 [R=301,L]
This will change usa/sometitle
to usa-sometitle-2014
, but I won't change /usa/music-events
Upvotes: 2