# Check Rewrite and Update to /home?

**URL:** <https://www.ruby-forum.com/t/check-rewrite-and-update-to-home/220069>\
**Category:** NGINX\
**Created:** [May 27, 2012, 12:51am UTC](https://www.ruby-forum.com/t/check-rewrite-and-update-to-home/220069 "2012-05-27T00:51:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 27, 2012, 12:51am UTC](https://www.ruby-forum.com/t/check-rewrite-and-update-to-home/220069/1 "2012-05-27T00:51:03Z")

</div>

Hello Gents,

Right now, we catch all [http://www.domain.com](http://www.domain.com) requests and do a simple  
rewrite to [https://www.domain.com](https://www.domain.com). I would like to update this re-write  
to point to [https://www.domain.com/home](https://www.domain.com/home).

Here is my server section for the non-SSL (http) server:

server {  
listen 192.168.1.1:80;  
server\_name [www.domain.com](http://www.domain.com);  
location / {  
add\_header X-Frame-Options SAMEORIGIN;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For  
$proxy\_add\_x\_forwarded\_for;  
proxy\_next\_upstream error timeout invalid\_header;  
rewrite ^ https://$server\_name$request\_uri? permanent;  
}  
}

How should I modify the rewrite statement to point to /home? My  
Google-Fu is failing me.

Posted at Nginx Forum:

> **[Check Rewrite and Update to /home?](https://forum.nginx.org/read.php?2,226862,226862#msg-226862)**
>
> Hello Gents, Right now, we catch all http://www.domain.com requests and do a simple rewrite to https://www.domain.com. I would like to update this re-write to point to https://www.domain.com/home. Here is my server section for the non-SSL (http)...

---

<div class="post-metadata">

**Author:** ![mevans336](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@mevans336](https://www.ruby-forum.com/u/mevans336)\
**Post date:** [May 27, 2012, 1:29am UTC](https://www.ruby-forum.com/t/check-rewrite-and-update-to-home/220069/2 "2012-05-27T01:29:03Z")

</div>

Hi,

How about changing this:

> rewrite ^ https://$server\_name$request\_uri? permanent;

To this:

> rewrite ^ https://$server\_name/home$request\_uri? permanent;

I haven’t tried this yet, but I’m going to need something similar for a  
project I’m working on. Let me know how it works.

Regards,

–  
Javi Lavandeira

> **[Javier Lavandeira - Home](https://www.lavandeira.net)**
>
> Personal site of Javier Lavandeira. IT and cybersecurity professional from Catalonia living in Japan since 2002.

---

<div class="post-metadata">

**Author:** ![mevans336](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@mevans336](https://www.ruby-forum.com/u/mevans336)\
**Post date:** [May 27, 2012, 6:52am UTC](https://www.ruby-forum.com/t/check-rewrite-and-update-to-home/220069/3 "2012-05-27T06:52:25Z")

</div>

Here is my SS: 259 71 2451

---

<div class="post-metadata">

**Author:** ![mevans336](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@mevans336](https://www.ruby-forum.com/u/mevans336)\
**Post date:** [May 29, 2012, 3:47pm UTC](https://www.ruby-forum.com/t/check-rewrite-and-update-to-home/220069/4 "2012-05-29T15:47:43Z")

</div>

Hi Javi,

Thank you, that appears to have worked perfectly.

## Javi Lavandeira Wrote:

> permanent;  
> [http://www.lavandeira.net](http://www.lavandeira.net)
> 
> > to point to [https://www.domain.com/home](https://www.domain.com/home).  
> > proxy\_set\_header Host $host;
> > 
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,226862,226969#msg-226969](http://forum.nginx.org/read.php?2,226862,226969#msg-226969)
