When setting up WordPress Multisite the instructions
tells you to add URL rewrite rules, but they're for Apache using .htaccess only...
For Laravel Valet we have created
a driver file
that you can drop into your ~/.config/valet/Drivers/
(before v2.1.0 Valet drivers path was at ~/.valet/Drivers/)
Laravel Homestead's Nginx configuration can be extended using this nifty trick inspired by Otley's comment from this Laracasts thread.
Follow these steps:
-
Find your homestead
scriptsdirectory in your local machine. It may be~/Homestead/scripts/or~/.composer/vendor/laravel/homestead/scripts/depending on your Homestead installation. -
Edit
serve-laravel.shand addinclude /etc/nginx/conf.d/$1-custom;just above thelocation ~ \.php$-block andtouch "/etc/nginx/conf.d/$1-custom"at the end of the file (or just beforeservice nginx restart- if present). -
Reprovision Homestead by running
vagrant reload --provisionin your homestead directory (where theVagrantfileis). -
SSH into your Homestead box (usually by running
vagrant sshin your homestead directory). -
In the Homestead box,
cd /etc/nginx/conf.d/and edit the file therein corresponding to your WordPress Multisite. The WordPress documentation for Nginx gives us the rules to add in the custom rules file:
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}- Run
sudo service nginx restartwithin your Homestead box to reload Nginx after adding custom rules.