【发布时间】:2016-09-24 23:40:23
【问题描述】:
以下是一些旧网址的示例:
http://www.test.com/files/Old_Name.zip
http://www.test.com/files/Old_Name.php
http://www.test.com/files/Old_Name_Setup.php
http://www.test.com/files/Old_Name_100_Setup.php
以下是新 URL 的外观:
http://www.test.com/files/New_Name.zip
http://www.test.com/files/New_Name.php
http://www.test.com/files/New_Name_Setup.php
http://www.test.com/files/New_Name_100_Setup.php
我需要编辑我的 .htaccess 文件以反映这些更改,因此当人们访问旧 URL 时,他们会被带到新 URL。
我见过类似的东西
Redirect 301 /files/Old_Name.php http://www.test.com/files/New_Name.php
不幸的是,这种方式需要我对每个文件都这样做,而且有很多。我猜我将不得不使用regex,但我还没有在网上看到只修改部分文件名的解决方案。我假设这应该能够在 1 行中完成,因为新旧 URL 之间的结构更改是一致的。
【问题讨论】: