felixarntz / wordpressdev

WordPress core development environment based on Lando.
GNU General Public License v2.0
13 stars 0 forks source link

Add plugin that redirects from /wp-admin/* to /core-dev/build/wp-admin/* #15

Open westonruter opened 5 years ago

westonruter commented 5 years ago

My muscle memory is strong for going to /wp-admin/ to access the admin. We should add a redirect to make it easier to access the admin.

westonruter commented 5 years ago

This should also work for /wp-login.php as well.

It turns out that a plugin will not suffice for redirecting this or for redirecting /wp-admin/index.php because the presence of .php causes Nginx to not route through WordPress:

https://github.com/lando/lando/blob/d0198bbb5304c0aafaf5f867e9e3651173d80e41/plugins/lando-recipes/recipes/wordpress/wordpress.conf#L46-L55

At the moment if I try going to such a PHP file URL, I get:

File not found.

It seems that the config file should include the following in that location directive to ensure that *.php URLs would get routed to WordPress for 404 nadling:

if ( ! -f $request_filename ) {
    break;
}
felixarntz commented 5 years ago

I think we don't need to go overboard with this. Redirecting the specific /wp-admin/ URL will be the most important benefit I believe as this is the URL many people remember and just type. I doubt people often enter things like /wp-admin/options-general.php directly, unless it was stored in their browser history in which case the URL should be correct already.

I agree we should fix this even more comprehensively by adjusting the Nginx config if possible. But if doing so, we should fix that problem specifically IMO instead of tweaking existing rules that might cause other side effects. I wonder whether it's possible to read the .env or wp-cli.yml file from Nginx.

I opened #18 for the MU plugin. We could then follow up on the rest separately.