【发布时间】:2018-07-17 06:51:44
【问题描述】:
我想做一些重定向,但为此我需要解析域以发送其他域。
我的旧域名网址是这样的
http://olddomain.com/bg/some-name-part-421.html
http://olddomain.com/bg/some-name-1231.html
http://olddomain.com/bg/some-name-product-name-221.html
我想把这个重定向到喜欢这个
https://www.newdomain.com/magazin/some-name-part.html
https://www.newdomain.com/magazin/some-name.html
https://www.newdomain.com/magazin/some-name-product-name.html
我尝试在服务器块上像这样重定向它们
rewrite ^(/bg/)([a-z-]+-[0-9]+)\.html$ http://www.newdomain.com/magazin/$2 permanent;
这样的重定向效果不好
http://www.olddomain.com/bg/chervena-borovinka-bioherba-3694.html
https://www.newdomain.com/magazin/chervena-borovinka-bioherba-3694
我也想删除数字的最后一部分 - 但我不知道为什么不能正常工作
【问题讨论】: