htacess部分文件名后缀匹配 [英] htacess partial filename suffix match

查看:140
本文介绍了htacess部分文件名后缀匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为一个站点迁移的一部分,我有一堆的,我想重定向到一个新的站点旧文件。旧的文件全部结束与_reviews.html,但新的目标是不同的服务器上,没有名字的_reviews的一部分,但还是在结束html的。例如:

As part of a site migration, I have a bunch of old files that I want to redirect to a new site. The old files all end with _reviews.html, but the new destination is on a different server, without the "_reviews" part of the name, but still ending in .html. For example:

旧:www.a.com/my_product1_reviews.html 新:www.b.com/my_product1.html

Old: www.a.com/my_product1_reviews.html New: www.b.com/my_product1.html

我有几百个这样的,所以我真的不希望做他们一次一个,但我似乎无法得到正确的语法。谢谢你,

I have a few hundred like this so I didn't really want to do them 1 at a time, but I can't seem to get the correct syntax. Thanks,

比尔

推荐答案

试试这个:

RewriteEngine On
RewriteBase /
RewriteRule (.*)_reviews.html$ http://www.b.com/$1.html [L,R=301]

这篇关于htacess部分文件名后缀匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆