簡體   English   中英

如何使用htaccess將鏈接重定向到另一個鏈接?

[英]how to redirect a link to another link using htaccess?

我有一個像這樣的鏈接:

www.website.com/index.php?id=123456

我想重定向到:

www.website.com/test.php

問題是id每次都可以不同,可以是id=123456id=632456

關於如何解決這個問題的任何想法?

謝謝

編輯:

如果我想將其重定向到www.website.com/test.php?id=123456或其他ID,該怎么辦?

像這樣:

RewriteRule index\.php.* test.php

或者您可以更具體:

RewriteRule index\.php\?id=[0-9]+$ test.php

或者您也可以發送ID:

RewriteRule index\.php\?id=([0-9]+)$ test.php?id=$1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM