使用htaccess将静态重定向到动态URL

时间:2012-05-11 01:09:12

标签: php .htaccess mod-rewrite

在我的情况下,我需要相反的方式,我有超过1000个链接,如www.domain.com/msg/98212.html,我必须将它们重定向到新的动态生成页面,如www.domain.com/msg/view.php?id=98212

id或98212.html与文件不同。

这么简单吗?

2 个答案:

答案 0 :(得分:1)

RewriteRule ^msg/([0-9]+).html msg/view.php?id=$1 [L]

如果您希望在用户的浏览器中显示新网址,请将其设为[R,L]

答案 1 :(得分:0)

RewriteRule /msg/[0-9]+).html /msg/view.php?id=$1 
相关问题