fbpx

404 error on downloading file in WP Engine hosting

If you host your website in a WP Engine server you may encounter 404 errors on some type of files.
This is because WP Engine uses a proxy with a particular configuration.

First of all if you have changed the default SEO url in the plugin configuration page, please note this value and replace it in the first line of the code we provide in the next lines (location ~* ^/replace_here_if_you_have_changed_it/* {).

Then please contact directly the WP Engine support https://wpengine.com/support/ and provide this informations :

We use the WP File Download plugin from Joomunited. When this plugin is used under your environment we encounter 404 errors when we try to download files managed by this plugin.
This question has already been asked to the WP Engine and you fixed it for other customers according to the following explanation.
The WP File Download plugin generates files url that are processed by a php script.
For exemple /downloads/14/category/11/file.pdf is internally redirected, by the default htaccess rules, to the main index.php file.
But as you're serving static files through an Nginx proxy and if the file is not found, the proxy returns a 404 error and the index.php script is never called.
In order to fix this 404 error, we need you to add to our site's "Before" rules this lines, assuming the port 6789 is still the correct one on your side.
location ~* ^/download/* {     proxy_pass http://localhost:6789;     $dynamic_upstream_read_only; }