【发布时间】:2018-04-19 23:27:54
【问题描述】:
使用Wordpress/Woocommerce最新版本:
我需要 301 将我的旧商店网址重定向到我的新网站,该网站有更清晰的网址,但有超过 2000 个网址,我希望尽可能多地自动执行此操作。希望 .htaccess 中的正则表达式模式可以做到这一点?我对如何做到这一点的了解非常有限,因此非常感谢任何帮助。
旧网址格式
foobar.com/vintage-industrial/3135-sgabello-alto-cindy-industrial-arredamento-industrial-sgabello-.html
foobar.com/shabby-e-provenzale/3270-cubo-cottage-2-cassetti-arredamento-shabby-chic-etnico-nordico.html
foobar.com/mobili-etnici/3286-armadio-lambert-blue-arredamento-etnico-classico.html
foobar.com/mobili-etnici/3335-tavolo-telgede-80-tavolo-rustico-industrial-arredamento-etnico-arredamento-industrial.html
foobar.com/sedie-sgabelli/1687-sedia-jenny-arancio-sedie-colorate-pop-vintage.html
上面的例子显示了一个目录,可以是任何东西,后面是产品id和名称
新的网址格式
foobar.com/prodotto/sgabello-alto-cindy
foobar.com/prodotto/cubo-cottage-2
foobar.com/prodotto/armadio-lambert-blue
foobar.com/prodotto/tavolo-telgede-80-tavolo
foobar.com/prodotto/sedia-jenny-arancio
每个新网址都将采用这种简单的格式,并且所有网址都将具有“prodotto”基本网址
旧的url里面塞了很多关键词,新的url已经去掉了
更新
有什么办法可以去掉这部分旧网址:
'vintage-industrial/3135-'
我认为这就是我可能需要做的所有事情,因为 mod_rewrite 应该从 url 的其余部分找到产品?所以我会留下
foobar.com/sgabello-alto-cindy-industrial-arredamento-industrial-sgabello
谢谢
【问题讨论】:
-
你能再举几个例子来说明清楚吗?
标签: wordpress .htaccess woocommerce url-redirection