# Nginx maintenance page/redirect with ip exception

**URL:** <https://www.ruby-forum.com/t/nginx-maintenance-page-redirect-with-ip-exception/227839>\
**Category:** NGINX\
**Created:** [March 30, 2013, 3:45pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-page-redirect-with-ip-exception/227839 "2013-03-30T15:45:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cavamondo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbce88/32.png) [@cavamondo](https://www.ruby-forum.com/u/cavamondo)\
**Post date:** [March 30, 2013, 3:45pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-page-redirect-with-ip-exception/227839/1 "2013-03-30T15:45:38Z")

</div>

Coming fra Apache/htaccess, im trying to get my head around the Nginx  
paradigme. Im trying to achieve a temporary redirect to a  
[www.mysite.com/maintenance.html](http://www.mysite.com/maintenance.html) page, for all visitors to [www.mysite.com](http://www.mysite.com)  
except visitors coming from IP:xx.xx.xx.xx.wich should have fuul access  
to  
the site.

I know how to achieve this with htaccess, but this doesnt applya to  
Nginx. I  
have tried different suggestions on modding nginx.conf, default.conf and  
mysite.cong file. I using virtual host and my site conf is placed in:  
/etc/nginx/sites-available/

Any simple solution to redirect all visitors except visitors defined by  
IP?

Posted at Nginx Forum:

> **[Nginx maintenance page/redirect with ip exception](https://forum.nginx.org/read.php?2,237978,237978#msg-237978)**
>
> Coming fra Apache/htaccess, im trying to get my head around the Nginx paradigme. Im trying to achieve a temporary redirect to a www.mysite.com/maintenance.html page, for all visitors to www.mysite.com except visitors coming from IP:xx.xx.xx.xx.wich...

---

<div class="post-metadata">

**Author:** ![cavamondo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbce88/32.png) [@cavamondo](https://www.ruby-forum.com/u/cavamondo)\
**Post date:** [March 31, 2013, 12:44pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-page-redirect-with-ip-exception/227839/2 "2013-03-31T12:44:43Z")

</div>

Moved this post to “How to” section …

Posted at Nginx Forum:

> **[Re: Nginx maintenance page/redirect with ip exception](https://forum.nginx.org/read.php?2,237978,237990#msg-237990)**
>
> Coming fra Apache/htaccess, im trying to get my head around the Nginx paradigme. Im trying to achieve a temporary redirect to a www.mysite.com/maintenance.html page, for all visitors to www.mysite.com except visitors coming from IP:xx.xx.xx.xx.wich...
