Nginx rewites to a static URL

We use Nginx here for load balancing and as our HTTP server.

We have just started a new company called Ruby50 and I needed to get NGinx to rewrite to a static holding URL until the website is ready to go live. This is how I did it.

server { server_name ruby50.com; rewrite ^.*$ http://blog.dynamic50.com/index.php/ruby50$1 permanent; }

This rewrites anything going to ruby50.com and redirects it to a page on this blog. Do not forget to include any subdomains (such as www.ruby50.com):

server { server_name www.ruby50.com; rewrite ^(.*) http://ruby50.com$1 permanent; }

So this is everything you need:
server { server_name www.ruby50.com; rewrite ^(.*) http://ruby50.com$1 permanent; } server { server_name ruby50.com; rewrite ^.*$ http://blog.dynamic50.com/index.php/ruby50$1 permanent; }

No Comments

RSS feed for comments on this post. TrackBack URL

No comments yet.

Leave a comment

Preview: