cancel
Showing results for 
Search instead for 
Did you mean: 

How to bypass Magentos 404 error pages

Occasional Contributor

How to bypass Magentos 404 error pages

I would like to bypass the 404 error page that Magento generates and use a blank 444 one that Nginx has. The reason for this is that most of my traffic is not humans but it is script and zombie computers that scan for known vulnerable locations. Serving up pretty pages for these computers uses RAM and other resources. I want to return nothing to them and just let them send a bunch of requests to Nginx and get nothing back.

 

Also, if a real person is looking for unknown locations, they shouldn't be. My traffic comes from search engines and real hyperlinks, not people putting in special URL locations beyond the domain name. I don't see a need for fancy 404 pages.

 

How can I disable the Magento 404 page error rendering?

  • community-edition
Tags (1)
5 REPLIES
1 x Certified

Re: How to bypass Magentos 404 error pages

Still could not able to understand the purpose completely. How bypassing 404 will help. Rather get a WAF to secure your site from such attacks. This days WAF are very cheap and can provide good security features.

New Contributor

Re: How to bypass Magentos 404 error pages

Magento has a built in function for where to send 404s to, it is likely this is configured to send them to the home page.

In the admin panel, goto System -> Configuration then select Web under General on the left, and open up the tab Default Pages

There should be a CMS No Route Page, which is likely currently set to the Home Page, Change this to your desired CMS page and you should be fine. You may need to clear the cache before you see this change take effect.

Occasional Contributor

Re: How to bypass Magentos 404 error pages

Thanks for the response. The solution you show is the way to do it with Magento serving the error pages. I can make a custom error page in Magento and serve that page to those who access pages that are not known. However, the pages are still being served. Even if just a few characters there is CSS and javascript being sent. I am looking to serve nothing for 404 pages. I want to drop them like Nginx does for 444 pages.

 

Dropping sends absolutely nothing. Once a page request comes in that is not exists, it simply drops and sends nothing to client. That is what I want to do. I still haven't found a way to do this due to Magento doing error pages.

1 x Certified

Re: How to bypass Magentos 404 error pages

@tommygunnerMake sense. I guess this can be achieved in 2 steps.

 

Steps 1: Configure server setting to handle 404 errors instead of Magento. Once done Nginx/Apache will handle it.

 

Step 2: Below is Nginx example code. To forward 404 request to 444.

 

server {
error_page 500 502 503 504 =444 @blockrequest;

  location @blockrequest {
    return 444;
  }
}

 

Highlighted
Occasional Contributor

Re: How to bypass Magentos 404 error pages

Thanks, I have something like that but not working and tried your example also. The Magento error messages are still displaying.