Adding a redirect to nginx and Rapp

Log into your Webby using the git user (the user you normally use to deploy). And go to the following directory:

cd /opt/nginx/phd-sites

Let’s assume you want to redirect the domain mydomain.us to mydomain.com. You’ll have to create a file called mydomain.us with the following contents:

server {
    listen              80;
    server_name         mydomain.us;
    rewrite             ^/(.*) http://mydomain.com/$1 permanent;
}

Restart nginx:

/etc/init.d/nginx restart

And then when you visit any URL in mydomain.us, it should redirect to the same URL in mydomain.com.

Comments
blog comments powered by Disqus