以下是旧网址的一些示例:
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
以下是新网址的内容:
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文件以反映这些更改,因此当人们访问旧网址时,会将其转到新网址。
我见过像
这样的东西Redirect 301 /files/Old_Name.php http://www.test.com/files/New_Name.php
不幸的是,这种方式需要我为每个文件执行此操作,并且有很多。我猜我将不得不使用regex
,但我还没有在网上看到只修改部分文件名的解决方案。我假设这应该能够在一行中完成,因为旧URL和新URL之间的结构变化是一致的。
答案 0 :(得分:0)
您可以在0x0B,0x0C,0x4A,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x0A,0x00,0x00,0x00,0xAF,0x27,0x67
中使用:
/files/.htaccess
或在根RewriteEngine on
RewriteRule ^Old_Name(.*)$ New_Name$1 [NC,L,R=301]
中:
.htaccess