Issues with Bedrock and WP_HOME / WP_SITEURL

Hello,

I’ve got a vagrant LAMP stack based on Onema that handles standard WP installations quite ok. I’ve been wanting to build composer and capistrano into my dev / deploy process for some time so Bedrock is quite timely. I was able to follow the installation instructions through Step 5 without issue. However, I do have an outstanding issue with .env relating to the URL for site.

In my .env file:
WP_HOME = http://example.dev
WP_SITEURL = http://example.dev/wp

Both show up in wp-admin as expected and un-modifiable. However the site will not display at http://example.dev, only the /wp/ path.

Just to confirm, is this after running the WP install?

Yes - But I didn’t have the wp_home or wp_siteurl set prior to installation.

I just deleted the database and did fresh WP install (with those values set in wp_config) and same issue persists.

Some other possibly useful info to help troubleshoot:

  1. If I attempt to go to http://example.dev/ I get routed to http://localhost
  2. If I put an index.html in the root folder I can access it via browser properly.

J

What happens at http://example.dev/index.php ? It could just be a DirectoryIndex issue in apache.

Same as pointing to example.dev - It resolves back to localhost

I’ve confirmed that in the VM /etc/apache2/mods-enabled/dir.conf has

      DirectoryIndex index.html index.cgi index.pl index.php index.xhtml

I’ve tried putting a .htaccess DirectoryIndex at the root of this site and no effect.

Not sure how else to see where else there might be apache issue or troubleshoot if that is direct source of problem.

When I setup a site on same VM with WP in root of site (not /wp/) it displays properly. Although modifying the /index.php to be echo phpinfo() instead of the call to /wp/wp-blog-header it also redirects to localhost.

Update #1

I setup a new non-Bedrock site with the VM that worked successfully:

  1. Wordpress in sub-directory /wp/
  2. index.php does require of /wp/wp-blog-header.php
  3. wp-config.php based off wp-config-sample.php with DB info + WP_HOME and WP_SITEURL defined as above.

I’m not sure if that eliminates the DirectoryIndex concern @Foxaii mentioned or not - but does reduce / focus the scope of issue in my mind a bit towards something specific to Bedrock and how it setup interacts with a Vagrant VM at least.

Update #2

I started a fresh environment and instead of cloning Bedrock I incrementally added pieces from Bedrock and new environment appears operational with the following:

  1. Composer.json
  2. composer install
  3. Config folder
  4. App folder
  5. .env file, index.php and wp-config.php

The site is accessible in proper methods still. Will let you know how it proceeds as I add the Capistrano elements. Don’t see any particular reason that would cause home dir issues.

Working = working = happy.

I’m glad you have now got it working.

If an index file with echo phpinfo(); also redirected to localhost then I’m pretty confident it was a server config issue, not anything directly related to Bedrock. Fortunately these issues will be ironed out when Vagrant support is finalised.

Bedrock seems pretty different but if anyone has used a subdirectory install or a setup like WP Skeleton it really isn’t that different. So it does usually turn out to be web server config issues or not starting from scratch. I’d still like to get a better FAQ/Wiki up for common problems.

If you do get a FAQ/Wiki structure setup - I’ll happily populate all the pain points I hit with where I was able to find answers. I’ve got a blog post started that has been keeping most of the links but I’d happily put it in a better structure like you’re aiming for.

Interesting to read.
I’m having a similar problem using Bedrock with VVV.
Details here: