【发布时间】:2012-07-11 14:32:18
【问题描述】:
我有我们以前网站的旧网址
http://site.com/fixed-word/changing-category/12345-title-of-story
“变量”在哪里
不断变化的类别:例如体育、政治等
和
12345-title-of-story:12345 是旧的 id,其余的是故事 slug/title
新网站仅使用这种格式的故事片段
http://site.com/another-fixed-word/title-of-story
是否可以在nginx中创建301重写规则来实现?
我试过了:
重写 ^/fixed-word/([^\?]+)$/([^\?]+)$ /index.php?tipo=old_article&slug=$1 last;
想法是在 php 中获取 slug 并从 slug (12345-) 中删除数字 id 但不起作用,老化返回 404
有什么建议吗?
谢谢
【问题讨论】:
标签: url-rewriting nginx