簡體   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