Friday, 9 August 2013

Apache RewriteRule, directory update then remove trailing slash (beautify URL)

Apache RewriteRule, directory update then remove trailing slash (beautify
URL)

Currently have two requirements
Rewrite /olddirectory/ to /newdirectory/
Rewrite /newdirectory/pagename-3049103/ to just /newdirectory/pagename/
I have achieved step #1 using the following:
RewriteRule ^olddirectory/(.*)$ newdirectory/$1 [R=301,L]
Need assistance in step #2
The content is at /newdirectory/pagename-3049103/
I want to clean the url and display as /newdirectory/pagename/
Any help is greatly appreciated

No comments:

Post a Comment