Jump to content
Jonathan Lahijani

404 static file approach not working?

Recommended Posts

In PW's htaccess file, you can have a custom 404 page like this:

# -----------------------------------------------------------------------------------------------
# 2. ErrorDocument settings: Have ProcessWire handle 404s 
# For options and optimizations (O) see: 
# https://processwire.com/blog/posts/optimizing-404s-in-processwire/
# -----------------------------------------------------------------------------------------------

#ErrorDocument 404 /index.php
ErrorDocument 404 /my-404-page.html

It doesn't seem to be working... meaning it still brings up PW's 404 page rather than that static file.  I disabled ProCache and its htaccess settings, Jumplinks, Page Path History, etc. and no luck.  I tried on both my dev and live server and no luck either.  The .htaccess version is the latest one (3.0.1). I'm using Apache 2.4.x.  Can anyone replicate this issue?

edit: I also tried it on another separate site/installation and same issue.

Share this post

Link to post
Share on other sites
Posted (edited)

For me it is working as expected and described in the Blog post. 


I added a static html for 404 like in your example above, and then added one line just above the last line in pws htaccess file:

RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|gif|png|svg|ico|html)$ [NC]

as stated in the Blog post https://processwire.com/blog/posts/optimizing-404s-in-processwire/#filtering-out-missing-image-files

And when I try to reach /test/noexist.html, it works.

Edited by horst

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...