# Redirect 404 errors to the home page

**URL:** <https://www.ruby-forum.com/t/redirect-404-errors-to-the-home-page/227954>\
**Category:** NGINX\
**Created:** [April 4, 2013, 12:41pm UTC](https://www.ruby-forum.com/t/redirect-404-errors-to-the-home-page/227954 "2013-04-04T12:41:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnybut7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@johnnybut7](https://www.ruby-forum.com/u/johnnybut7)\
**Post date:** [April 4, 2013, 12:41pm UTC](https://www.ruby-forum.com/t/redirect-404-errors-to-the-home-page/227954/1 "2013-04-04T12:41:11Z")

</div>

Hi,

Ive received a request stating that the website owner wants all 404  
error  
messages redirected to the home page as its affecting their seo  
ranking(im  
not sure about this myself but thats another issue). Its a rails  
application  
so i have static page displayed currently and even applied some  
javascript  
to redirect to the home page but the seo tool still states there are X  
amount of broken links and that redirecting to the home page via the  
server  
config will fix this.

I cant seem to get this to work in the nginx config, can anyone help me?  
Ive tried various solutions but nothing is working 100%.

Posted at Nginx Forum:

> **[Redirect 404 errors to the home page](https://forum.nginx.org/read.php?2,238094,238094#msg-238094)**
>
> Hi, Ive received a request stating that the website owner wants all 404 error messages redirected to the home page as its affecting their seo ranking(im not sure about this myself but thats another issue). Its a rails application so i have static...

---

<div class="post-metadata">

**Author:** ![johnnybut7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@johnnybut7](https://www.ruby-forum.com/u/johnnybut7)\
**Post date:** [April 4, 2013, 2:16pm UTC](https://www.ruby-forum.com/t/redirect-404-errors-to-the-home-page/227954/2 "2013-04-04T14:16:26Z")

</div>

On 4 April 2013 11:40, johnnybut7 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I cant seem to get this to work in the nginx config, can anyone help me?  
> Ive tried various solutions but nothing is working 100%.

[Module ngx\_http\_core\_module](http://nginx.org/r/error_page) with  
[Module ngx\_http\_proxy\_module](http://nginx.org/r/proxy_intercept_errors) should do what you want.  
Let us know how you get on.

Jonathan

---

<div class="post-metadata">

**Author:** ![johnnybut7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@johnnybut7](https://www.ruby-forum.com/u/johnnybut7)\
**Post date:** [April 4, 2013, 2:32pm UTC](https://www.ruby-forum.com/t/redirect-404-errors-to-the-home-page/227954/3 "2013-04-04T14:32:49Z")

</div>

Thanks, ive already used this resources trying the below but it doesnt  
make  
a difference, the rails static page is still being served. I think  
maybe i  
need to disable that first, thanks for your help.

error\_page 404 =301 [http://example.com/notfound.html](http://example.com/notfound.html);

Posted at Nginx Forum:

> **[Re: Redirect 404 errors to the home page](https://forum.nginx.org/read.php?2,238094,238103#msg-238103)**
>
> Hi, Ive received a request stating that the website owner wants all 404 error messages redirected to the home page as its affecting their seo ranking(im not sure about this myself but thats another issue). Its a rails application so i have static...
