我有许多已移动的上载文件,并且我试图使用.htaccess文件将子文件夹中的所有文件重定向到另一个文件夹中的相同文件。像这样:
http://www.example.com/Downloadfiles/VaCom_General.pdf-> http://www.example.com/wp-content/uploads/VaCom_General.pdf
http://www.example.com/Downloadfiles/EnergyDashboard%20Brochure.pdf -> http://www.example.com/wp-content/uploads/EnergyDashboard%20Brochure.pdf
我在htaccess文件中尝试了各种RewriteRules(结尾处带有和不带有[R=301,NC,L]
)...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^Downloadfiles/(.*)$ /wp-content/uploads/$1 [R=301,NC,L]
</IfModule>
我也尝试过:
RewriteRule https://www.example.com/Downloadfiles/(.*)$ https://www.example.com/wp-content/uploads/$1 [R=301,NC,L]
我基于这篇帖子.htaccess redirect all files in one folder to exact same in another folder
如何使文件正确重定向?