繁体   English   中英

将具有参数的旧网站重定向到具有相同域下的参数的新网站

[英]Redirect old website with parameters to new website with parameters under the same domain

我正尝试重定向我的旧页面,因为网站正在进行升级(从Coldfusion到PHP),并且我们希望过去的访问者仍然能够使用旧链接访问文章。

http://examplepage.com/article.cfm?ArticleID=3163

http://examplepage.com/articles.php?id=3163

我看过很多文章,但找不到能按照我想要的方式工作的文章,请指教!

更新:我找到了一个解决方案,它可以工作,但这是最好的方法吗?

RewriteEngine On

RewriteCond %{THE_REQUEST} /article\.cfm\?ArticleID=(\d+) [NC]
RewriteRule ^ /article\.php\?id=%1 [R=301,L,NE]
RewriteEngine On
RewriteCond %{QUERY_STRING} ArticleID=([^&]+) 
RewriteRule ^article.cfm$ /articles.php?id=%1 [R=301,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM