# Request domain redirection

**URL:** <https://discuss.konghq.com/t/request-domain-redirection/4401>\
**Category:** Questions\
**Created:** [September 10, 2019, 10:23am UTC](https://discuss.konghq.com/t/request-domain-redirection/4401 "2019-09-10T10:23:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![diel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/diel/32/1321_2.png) [@diel](https://discuss.konghq.com/u/diel)\
**Post date:** [September 10, 2019, 10:23am UTC](https://discuss.konghq.com/t/request-domain-redirection/4401/1 "2019-09-10T10:23:11Z")

</div>

Hi, I’m looking for a way to easily redirect all the requests to [http://x.y/anything](http://x.y/anything) to [https://z.w/anything](https://z.w/anything).  
I tried defining a new route matching x.y domain and adding request-termination plugin to return a 301 plus response-trasnformation with the location header set to z.w.  
Anyway this seems to redirect any request matching x.y domain to z.w base url without “forwarding” the querystring.  
Am I missing something? Is there another solution?

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [September 11, 2019, 6:33am UTC](https://discuss.konghq.com/t/request-domain-redirection/4401/2 "2019-09-11T06:33:22Z")

</div>

Please have a look at the following post:

> [@Redirecting HTTP to HTTPS](https://discuss.konghq.com/t/redirecting-http-to-https/2637/5):
>
> You could apply the following plugin for SSL redirect: apiVersion: configuration.konghq.com/v1 kind: KongPlugin metadata: name: https-redirect plugin: pre-function config: functions: - | local forwarded\_host = ngx.var.http\_x\_forwarded\_host or ngx.var.host ngx.header["Location"] = "https://" .. forwarded\_host .. ngx.var.request\_uri return kong.response.exit(302) Please apply this plugin on an Ingress which accepts all paths and all hosts on the http protocol. If this solves …

You can simply change the `forwarded_host` part of the redirect URL being constructed.
