记录日常点点滴滴,欢迎来到我的小站。

0%

Apache2.4 利用.htaccess设置单页面301跳转

根据客户的需求需要无缝301一个文件到另一个文件夹

参考了网上很多的示例,制作了下面的.htaccess文件,不正确的地方请大家指出

1
2
3
4
5
6
7
8
9
10
11
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^en/product/index.html$ https://www.ttwinbug.com/cplus/en/products/index.html [R=301,L]
RewriteRule ^en/product/$ https://www.ttwinbug.com/cplus/en/products/index.html [R=301,L]
RewriteRule ^id/product/index.html$ https://www.ttwinbug.com/cplus/id/products/index.html [R=301,L]
RewriteRule ^id/product/$ https://www.ttwinbug.com/cplus/id/products/index.html [R=301,L]
RewriteRule ^th/product/index.html$ https://www.ttwinbug.com/cplus/th/products/index.html [R=301,L]
RewriteRule ^th/product/$ https://www.ttwinbug.com/cplus/th/products/index.html [R=301,L]
RewriteRule ^vi/product/index.html$ https://www.ttwinbug.com/cplus/vi/products/index.html [R=301,L]
RewriteRule ^vi/product/$ https://www.ttwinbug.com/cplus/vi/products/index.html [R=301,L]
</IfModule>