简体   繁体   中英

Redirect sub domain to another domain with parameters

I need to redirect a sub domain ( http://xxxxx.greetandcare.me/?mode=yyyyy ) to another domain ( https://anotherdomain.com/__/verify?mode=yyyyy )

  • I tried to add NS, TXT, CNAME and A records to achieve this, but I was unable to apply the settings as these threw errors.

It would be great if there is a solution by redirecting it in the web browser when the URL is entered.

You're not going to be able to do this with DNS alone. You need to have a web server (eg Apache, nginx) responding to HTTP requests at your first domain which can forward requests through to your second domain.

If you're using AWS, Amazon S3 can do this via its webpage redirect functionality .

As far as I am aware you can only redirect domain / subdomain to another domain. The parameters will be passed on as part of the redirect.

Are you using apache? then you can add this to your apache's .htaccess

RedirectMatch "^/?mode=yyyyy/?$" " https://anotherdomain.com/__/verify?mode=yyyyy "

See here for more info: https://help.dreamhost.com/hc/en-us/articles/215747748-How-can-I-redirect-and-rewrite-my-URLs-with-an-htaccess-file-

Added the domain to Cloudflare to manage the DNS and created a page rule to achieve the need.

If the website is https://example.com/ * then the page rule redirects it to https://othersite.com/ $1

Here $1 is the content of *

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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