how to redirect the domain to another domain

October 5, 2016 2.2k views
Server Optimization

I have http://wikiquest.ru/ domain to your host cloud.digitalocean.com.
and has the domain http: //xn--c1aabfob6cfv0g.xn--p1ai/ on another host. I need to make a redirect from http://wikiquest.ru/ at http: //xn--c1aabfob6cfv0g.xn--p1ai/ how do I do this on your host?

p.s. I almost know nothing about this, please write in detail. Thank you

5 Answers

what are you use LAMP OR LEMP !!!

THIS FOR NGINX
server_name supports suffix matches using .mydomain.com syntax:

server {
  server_name wikiquest.ru;
  rewrite ^ http://www.xn--c1aabfob6cfv0g.xn--p1ai$request_uri? permanent;
}
server { server_name .domain.com;return 302 $scheme://forwarded-domain.com;}

APACHE2
Just create a very simple VirtualHost for the old domain in which you redirect it to the new domain:

<VirtualHost *:80>
    ServerName xy.example.com
    RedirectPermanent / http://abc.example.com/
    # optionally add an AccessLog directive for
    # logging the requests and do some statistics
</VirtualHost>```

or on any version 0.9.1 or higher:

server {
  server_name .mydomain.com;
  return 301 http://www.adifferentdomain.com$request_uri;
}
Have another answer? Share your knowledge.