How to Do htaccess 301 Redirect from Old Filename Pattern to New Filename Pattern?
- by user249493
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?