I’m running WordPress in a subdirectory with Local, i.e. http://local.dev/wordpress/ and it works fine unless I try and access the site via https. If I do, I get a too many redirects message whenever I try and access the front end or the wp-admin folder.
If I add remove_filter( 'template_redirect', 'redirect_canonical' ); to my functions.php I can see the front end, but none of the assets load as they are all requested via http:// and are blocked due to insecure content. The /wordpress/wp-admin/ or wp-login.php links still display the too many redirects error.
Does anyone know how I can fix this? I have a feeling its an nginx conf setting somewhere.
Hello!
I encountered the same problem. I still prefer to installl WordPress in subfolders, because different apps often exist on the same domain. I’m on iMac, with your last version of Local.
Thank you!
I was able to get this running by doing the following:
Create a new site. Even though this worked on both Preferred and Custom, I recommend using Custom for this setup that way you can tweak the nginx/Apache configs if needed.
Browse to the site’s app/public folder
Create a folder named wordpress
Move all of the files into wordpress except for index.php.
Copy index.php into wordpress
Open up index.php in app/public and adjust the require() call to include wordpress so it looks something like require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
Use Adminer or Sequel Pro to edit the siteurl option in wp_options to include /wordpress
Test the site! Make sure you hard refresh by pressing Cmd + Shift + R
I tested the site frontend, admin, login, and customizer with HTTPS and didn’t run into any problems.
Alas, we already did what you suggested.
Actually, that happens to be the procedure suggested by WordPress in the Codex (method 2) in order to have your website in a subfolder of public_html.
However, I noticed that new SSL installations in Local have the following snippet in wp-config.php:
/* Inserted by Local by Flywheel. See: http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy */
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}
Including the snippet in the wp-config.php of my existing WordPress installation made it work again!
I suspect that Local inserts the snippet automatically when the certificate is trusted; I guess somehow the insertion didn’t work on my wp-config.php.