Change URL subdirectory and filename for 437 file requests

I have 437 URL requests which were static files on Movable Type, which can only be viewed on WordPress and in a different subfolder, with modified filenames. I have tried for days to make Rewrite and Redirect work, but no success.

Here is an example in my root .htaccess file of what I need to do (this didn't work, though).



There are 4 changes to make:

  • subdirectory /archives/ changed to /WP-Void/

  • file-name-with-hyphens changed to file_name_with_underscores

  • .php lopped off filename

  • slash added to end of line

I have the following lines at the top of my root .htaccess:

Options -Indexes +FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on

Please note that .php files no longer exist in the archives subdirectory. Not sure if that makes a difference, but, error logs for the failed rewrites begin by stating that the requested file is not found in the /archives/ subdirectory.


This should work for you:

RewriteEngine on
RewriteRule ^archives/([0-9]{4})/([0-9]{2})/(.*)-(.*).php /WP-Void/$1/$2/$3_$4/ [R=301,L]

it should redirect pages from: 


Similar questions

Wordpress already Installed in root Directory and I have also installed wordpress in subdirectory, But the problem is subdirectory URL is not working
Wordpress already Installed in root Directory and I have also installed wordpress in subdirectory, But the problem is subdirectory URL is not working. It always give 404 error Root Subdirectory URL Root Directory .htaccess Sub-directory .htaccess
Japanese Character filename turns unnamed-file on file upload php
I am using a wordpress plugin (Drag and Drop Multiple File Upload-Contact Form 7) and I tried uploading japanese character filename ex. サンプル.pdf and when it is uploaded the filename changes to unnamedfile.pdf. My PHP version is 7.3.11 I tried adding this code : at the top of the plugin's php file. And it's not working. I also tried adding this cod...
WPMU site in subdirectory: When I clone a site with NS Cloner Pro plugin, how do I remove the subdirectory from the URL?
I have a WPMU site in a subdirectory /new/. So my main URL is I have been able to use .htaccess and copy the index.php file into the domain to achieve just for my main site. However... I have the 'NS Cloner Pro' plugin which clones WPMU sites in one click (great plugin!) but every clone still has the /new/ subdirectory....
.htaccess & WordPress url rewrite that shows /subdirectory/username but serves /subdirectory/
I have a unique issue with a WordPress site I am working on. My client would like a promotion where people get "customized" or "vanity" urls, but all the urls just go to the same WordPress page. With WordPress pretty urls enabled, the url that needs to display in the address bar looks like: However, it will just be serv...
Wordpress hosted in a subdirectory (of a rails app) has the wp-admin url without the subdirectory
The blog is available at The login url is accessible at But once logged in, the browser briefly shows in the url field and then redirects and finally shows the dashboard at the url Now all the url in the wor...
Redirect old subdirectory page requests under a new Wordpress installation
Our site was recently migrated from a basic php/mysql app to Wordpress. In the old app, we had content in a subdirectory which is now located on a new domain. Examples below. Old link: Should redirect to: The complicated angle is that the Old links are now a Wordpress installation. In the default .htaccess file of wordpress I see the following: I'v...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.