phranque - 12:34 am on Aug 19, 2013 (gmt 0)
RewriteRule ^/page-name-old/$1 http://www.example.com/page-name/$1 [R=301,L]
i forgot to mention one thing.
- When using the rewrite engine in .htaccess files the per-directory prefix (which always is the same for a specific directory) is automatically removed for the RewriteRule pattern matching and automatically added after any relative (not starting with a slash or protocol name) substitution encounters the end of a rule set. See the RewriteBase directive for more information regarding what prefix will be added back to relative substitutions.
- The removed prefix always ends with a slash, meaning the matching occurs against a string which never has a leading slash. Therefore, a Pattern with ^/ never matches in per-directory context.
if you were implementing this RewriteRule in the server config context it would be appropriate to match against the leading slash.