[英]Move All Files in One Folder and htaccess Redirect to Them?
I have a bunch of old static html sites. 我有一堆旧的静态html网站。 I want to install wordpress in the root on every site, but still keep the old pages.
我想在每个站点的根目录中安装wordpress,但仍保留旧页面。 So I want to somehow automate this process for every single file:
因此,我想以某种方式针对每个文件自动执行此过程:
website.com/category1/file1.html MOVED to website.com/files/file1.html
website.com/category1/file1.html移动到website.com/files/file1.html
.htaccess rule: .htaccess规则:
RewriteRule ^category1/file1.html$ files/file1.html [L]
I need to do this for 30+ sites with many files. 我需要对30个以上包含许多文件的网站进行此操作。 Is there a way to somehow automate this process?
有没有办法使该过程自动化?
This should work: 这应该工作:
RewriteRule ^category1/(.*)$ files/(.*) [R=301,L]
That will redirect website.com/category1/file1.html
to website.com/files/file1.html
. 这将把
website.com/category1/file1.html
重定向到website.com/files/file1.html
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.