How do I skip wordpress's 404 handling and redirect all 404 errors for static files to 404.html?
I read and it seems its not possible when using permalinks?
The objective is to reduce the server load for 404 errors by not loading php.
|
|
.htaccess skip WordPress 404 error handling for static files.
Note: These rules were generated by the W3 Total Cache plugin* Nginx skip WordPress 404 handling for static files.
|
||||
|
|
|
simple solution: use the conditional tag is_404() and create an redirect to your static file; include the code in the header.php or index.php of the theme. maybe a example from scratch.
links |
|||||||||||
|
|
I'm not sure that this is possible. If you look at the htaccess code that WordPress creates when you enable permalinks, it basically says: "If the file/directory cannot be found, send it to index.php." This includes all actual 404 requests. Outside of creating a list of every dynamically-generated public resource that WordPress knows of and directly inserting this into .htaccess, you'll need to load php to handle the 404's. |
|||
|
|
|
To extend on what Chris_O said....I would install W3 Total Cache and use the settings from that plugin to not cache static files. The plugin in itself is very useful and a must to speed up your site, especially with the latest update. Also I recommend you have a look at Creating an Error 404 Page from Wordpress to see how to handle 404 for static files, 403 (forbidden), etc. Its a good read. |
|||
|
|
|
There are 3 ways of doing this
Complete tutorial - How to Redirect 404 Error in WordPress |
||||
|