Short path rewrites not working with Roots + Bedrock [resolved]

Just been getting up to speed with the ace Bedrock framework. I’ve managed to happily add a few plugins, get SASS going in Grunt - it’s all good.

However, I’m having a problem with the asset paths. The generated CSS link is:

<link rel="stylesheet" href="/wp/wp-content/themes//theme-name/assets/css/main.min.css?ver=0940f08fdc917bddc53b9d37da9514f7">

This is obviously a bit messier than it should be.

If I do something like this:

wp_enqueue_style( 'custom-stylesheet', get_template_directory_uri().'/assets/css/custom-stylesheet.css' );

it comes out more like this:

<link rel="stylesheet" href="http://site-name.dev/wp/wp-content/themes//theme-name/assets/css/custom-stylesheet.css?ver=3.8.1">

The .htaccess file in my project/web/ folder is as follows:

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

# END WordPress

So, ideally I’d have the nice short URLs that Bedrock & Roots promised, but if I can’t have those working, then at least I’d like the normal WP urls back.

Any custom themes should be in app/themes/ instead of wp/wp-content/ (you should never modify anything in there since it’s managed by Composer). With your theme in the correct place, your asset paths would look like:

"http://site-name.dev/app/themes/theme-name/assets/css/custom-stylesheet.css?ver=3.8.1"

You could shorten that using something like the https://github.com/roots/roots-rewrites but with Bedrock we just recommend keeping it as the default since /app/themes/name/assets is nice enough to use now.

edit: you’re also getting a double slash // you should fix. Make sure there’s no trailing slashes in your WP_HOME or WP_SITEURL.

edit again: Just fixed the double slash bug which was our fault: https://github.com/roots/bedrock/commit/5f33bfe866f04cc978f37124a4123ef961cfe8d7

Brilliant! Thank you, simply moving the theme to app/themes has solved it. As you might expect, the double slashes went away then too.