Closed sheixt closed 9 years ago
I'll take a look at this. I have a guess as to the issue. For reference, could you check your YeoPress version for me?
OK here's the deal. YeoPress's default wp-config.php file does not work when wordpress is installed in a subdirectory (eg. localhost/site-name).
Two options.
1) Create a vhost on your local machine for something like site-name.dev and point it to your site-name installation directory. IMO this is the ideal option.
2) Update your wp-config.php like so:
if (!defined('WP_SITEURL')) {
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/site-name/cms');
}
if (!defined('WP_HOME')) {
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '/site-name');
}
if (!defined('WP_CONTENT_DIR')) {
define('WP_CONTENT_DIR', dirname(__FILE__) . '/site-name/content');
}
if (!defined('WP_CONTENT_URL')) {
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/site-name/content');
}
That will work fine for your local wordpress sites.
@sheixt I'll leave this open so you can confirm that the problem was resolved. I was able to recreate the issue and the above solution worked for me. But its interesting that it worked fine without the submodule install, as in theory it should still be an issue.
@Toddses thanks for the prompt reply! I investigated creating a vhost on my local machine, however embarrassingly I only managed to cripple my WAMPSERVER setup...!
So after restoring it, I've gone for option 2 and that works like a charm! Thanks for the help.
Out of interest why did you prefer option 1?
Typically when you deploy your site, it will live at the root URL (http://example.com). So you want to set up your local dev site to mimic the behavior you get from a root URL. This way you're not deploying a site that worked in a subdirectory, then going in and updating settings to deal with the root installation.
That said there are lots of use cases for keeping your local in a subdirectory, in particular if your live site will live in a subdirectory.
Actually, I may been a little keen to close this... I was able to run through the install fine, the set-up all seems fine wit the exception that It cannot seem to locate the themes:
Appearances > Themes
I'm presented with ERROR: The theme directory "twentyfifteen" does not exist.
On review, the theme files are present in both the cms
and content
directories so I am unsure why WordPress cannot seem to locate it. Any suggestions?
Most likely that's an issue with the WP_CONTENT_DIR constant. You might investigate what the output is of dirname(__FILE__)
. I'm not too familiar with windows behavior here.
I do know when I deploy to our remote servers I have to change that dirname()
call to $_SERVER['DOCUMENT_ROOT']
so that might be what you need as well.
Bang on, first time. You sir are are my favourite person of the day. Thanks again for you help.
You tend to remember the solutions to problems that bring you to tears :)
@Toddses HAHA, best response all day!
Haha brilliant! I'm grateful to have avoided that heartache.
Issue brief
I'm having an issue when attempting to run
yo wordpress
on my localhost (running on WAMPSERVER) and selecting the submodule option. After completing the installation, when I visit my site URL I'm presented with a 404 'Not Found' error.Configuration settings:
The installation of Git, the WP submodule and the theme all process without correctly and at the end I'm presented with the "All Done!! ... " notification. But when I visit
http://localhost/site-name
in my browser, I'm redirected tohttp://localhost/cms/wp-admin/install.php
and (unsurprisingly) it gets a 404 (as the directory & file doesn't exist). Any suggestions on how I can resolve this problem?Additional steps undertaken to try to find a workaround:
WordPress install directory
tosite-name/cms
and this works to a point... When viewing the site URL in a browser I'm directed to the WP famous 5 minute install, but it is creating an additional directory in the URL structuresite-name/site-name/cms/...
which is a pain.WordPress install directory
to/cms
and I get an error saying:Note: If I chose the non-submodule approach, the install works fine.