I have Old URLs in my site and it like this:
http://'www.example.com/newsroom/press-release/item/949-ItemAlias.html
I want to redirect it to :
http://'www.example.com/press/ItemAlias.html
I used this sentence in .htaccess
:
RewriteRule ^newsroom/press-release/item/(.*)$ /press/$1 [R=301,NC,L]
But this sentence redirect the URLs to http://'www.example.com/press/949-ItemAlias.html
Of course the (949-) is example, I want to remove the number and dash when i redirect the URLs. What is the changes i have to do in .htaccess?
Your regex should match the number, but not include it in the ()'s. ex:
The
[0-9]*
matches an arbitrary length number, followed by the-
. Only what's matched parens will be included in$1
.