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.
Related Posts
- Fix Linux File And Folder Permissions When Using Laravel Forge
- Fix Laravel Forge Site Creation Problems
- Fix "419 Sorry, your session has expired" After Renaming a Laravel Project
- Fix Laravel Valet - MySQL Has Gone Away
- Fix "504 Gateway Timeout" When Using Laravel Valet
- Fix "No application encryption key has been specified." When Using Laravel
- Fix "Call to a member function format() on string" in Laravel
- Install ImageMagick When Using Laravel Valet