How to Do htaccess 301 Redirect from Old Filename Pattern to New Filename Pattern?
Posted
by
user249493
on Pro Webmasters
See other posts from Pro Webmasters
or by user249493
Published on 2012-07-08T22:38:09Z
Indexed on
2012/07/09
3:23 UTC
Read the original article
Hit count: 209
htaccess
|301-redirect
I have a bunch of old files prefixed with "old-" (e.g. "old-abcde.php"). I need an htaccess rule to set up a 301 redirect so that any request for a file starting with "old-" goes to its corresponding new version (e.g. "abcde.php").
To be clear, I have many files, not just one, so I can't do a literal filename match. I basically just need to strip off the "old-" from request and redirect to the version without it.
I know I probably just need a simple regular expression, but I'm not good at writing them. Can anyone provide assistance?
© Pro Webmasters or respective owner