重定向子目录并链接到适当的链接

时间:2015-05-09 05:18:07

标签: apache .htaccess redirect

我有这样的链接

http://example.com/sub-directory/1111-product-link.html

其中1111可以是任何数字

我想设置301重定向规则以将其重定向到

http://example.com/product-link-1111.html

到目前为止还没有定期重定向301的线索

1 个答案:

答案 0 :(得分:0)

在/.htaccess文件中尝试:

RedirectMatch 301 ^/sub-directory/([0-9]+)-product-link\.html$  http://example.com/product-link-$1.html