从一个地址重定向到另一个地址

时间:2018-02-20 12:41:03

标签: .htaccess

我想将$ weird_address重定向到$ home_address,例如:

  

$ weird_address =" https://homepage.com/?val=search&bname=&town=Yanziyan&country=China&ll=on&full=full&ss=1"

     

$ home_address =" https://homepage.com/"

我尝试了很多不同的可能性:

1. RewriteRule "https://homepage.com/?val=search&bname=&town=Yanziyan&country=China&ll=on&full=full&ss=1" 
"https://homepage.com/" [R=301,L]
2. RewriteRule "^/\?val=search\&bname=\&town=Yanziyan\&country=China\&ll=on\&full=full\&ss=1$" 
    "https://homepage.com/" [R=301,L]
3. RewriteRule "^(.*)China(.*)$" 
    "https://homepage.com/" [R=301,L]
4. Redirect 301 "https://homepage.com/?val=search&bname=&town=Yanziyan&country=China&ll=on&full=full&ss=1" 
"https://homepage.com/" "https://homepage.com/"

还有更多..但没有任何效果。我的问题是如何重定向该链接?我在互联网上做过研究,但我一无所获。

1 个答案:

答案 0 :(得分:0)

很难说出你想要的是什么,但syntax就像:

Redirect /path/to/old.html http://www.example/path/to/new.html
Redirect /path/to/old.html /path/to/new.html

您收到错误消息吗?