Fix WordPress Subfolder 404 Errors When Using Laravel Forge

If you use WordPress in combination with a Laravel Forge provisioned server, you may encounter problems when WordPress is not installed at the root level.

I discovered especially REST errors (404), when the WordPress installation is contained in a subfolder. To fix that problem, add this to your nginx configuration:

server {
    [...]
    
    location /my_subfolder {
        try_files $uri $uri/ /my_subfolder/index.php?$args /my_subfolder/index.php?q=$uri&$args;
    }

    [...]
}

Replace my_subfolder by the name of your subfolder. If you have multiple WordPress installations in multiple subfolders, add one entry for every subfolder. After restarting nginx, your problems should be gone.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top