Installing roots in subdirectory

Have an issue deploying Roots in a subdirectory called ‘travel’. The DASH loads fine but it seems the header won’t load on the front end of the site. Racking my head knowing I am missing something obvious. If anyone has any thoughts/exp would love some suggestions.

wp-config.php

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/travel/wordpress');
define('WP_HOME',    'http://' . $_SERVER['SERVER_NAME']. '/travel/');
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/travel/wrk');
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/travel/wrk');
...
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

index.php (note have WP installed in dir ‘wordpress’

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . './wordpress/wp-blog-header.php' );

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /travel/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /travel/index.php [L]
</IfModule>

WP install folder structure

  • wordpress
  • wrk (themes)
    .htaccess
    index.php
    wp-config.php

Do the default themes work? If not, its generic WordPress support that you need.

Or you could try Bedrock, which cleans up your install and a lot more.

No theme loads. Figured I’d post and see if anyone ran into the same silly issue. I know it’s just my path to the wp-blog-header.php.

Thought about Bedrock, however just not ready for that yet path yet. Pretty familiar with Roots already and wanted to keep the workflow process consistent.

This ended up working. Placed a straight path to the wp-blog-header.php and commented out the require dir

define('WP_USE_THEMES', true);
require ('../travel/wordpress/wp-blog-header.php');
/** Loads the WordPress Environment and Template */
//require( dirname( __FILE__ ) . './wordpress/wp-blog-header.php' );

I’m glad that you got it sorted.

In future it may help to turn on PHP errors and check your dev tools for 404s.

I was doing this on a live site that was running another CMS on the root, to set this up all locally would have been a better option…lol. Too much work to get the other CMS setup locally though to have the env match.

But you’re right :wink: