WordPress.org

Ready to get started?Download WordPress

Forums

Path issue in running multiple local installs of WP within htdocs folder (5 posts)

  1. dadra
    Member
    Posted 3 years ago #

    Hi Folks,

    I'm a WP newbie...couldn't find anything in the forums to address my problem...

    I'm building a custom WP theme and have everything up and running locally using MAMP and Sequel Pro. I plan to use WP for building client sites in the future and wanted to allow room for multiple WP installs on my local machine. So I set up my root folder within another folder in htdocs. Like this:

    htdocs/sites/learningwordpress

    I figured this would allow me the flexibility to install WP as many times as I need for whatever projects come up. I don't know that that's the best way to approach it, but it's how it's currently set up and all has gone well until now. I built my custom theme as static html & css and am now slicing and inserting the code into WP.

    My problem is that certain file paths are broken. I can't get any images to load from the header.php or footer.php files within my theme. Calling external style sheets and javascript files using standard html doesn't work either.

    What's odd is that background images from style.css do load just fine. style.css is of course in the theme folder right alongside header.php and footer.php, so it seems to me the same path should work, but it doesn't. I've tried lots of different configurations with no luck.

    I did a test and shifted the files so that my root folder is htdocs itself...ditching the htdocs/sites/learningwordpress structure. When I did that, the problem was solved...everything loaded just fine.

    Seems like a problem with my embedded folder structure, but I really can't figure out why.

    Anyone know what's going on? I'd like to be able to have multiple local WP installs as I'm sure I'll be working on more than one project at a time in the future.

    I hope I'm being clear. Thanks in advance!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    You can run as many standalone WP install as you want within the same root - each in the own sub-folder - but you must use the same structure in your Site and WordPress urls (Settings->General).

  3. dadra
    Member
    Posted 3 years ago #

    esmi, thanks for the reply. Good to know I can run multiple installs within sub-folders.

    I checked my settings per your post and found that both my site and WordPress urls are set (I think) properly:

    http://localhost:8888/sites/learningwordpress

    Seem right?

    Again, style.css loads background images no problem using this path:

    images/bg.png

    But that same path won't load images in header.php, footer.php, etc.

    Weird?

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Are these images embedded in the template files or are they pulled in via CSS?

    If it's the former, check that you have correctly defined the first part of the imge src using something like <?php bloginfo('url');?> so that the full image urls are being generated correctly. Remember that WordPress and relative urls don't work well together - especially in template files.

    If the images are being generated via CSS, check your stylesheet. This is the one place where you do need to use relative urls.

  5. dadra
    Member
    Posted 3 years ago #

    Esmi, thanks for the suggestions. I resolved the images problem by following the instructions found here:

    http://www.brightcherry.co.uk/scribbles/2008/09/19/wordpress-get-image-path-relevant-to-theme

    To load additional style sheets I followed your advice in an old post (option #2):

    http://wordpress.org/support/topic/proper-way-to-link-to-the-stylesheet?replies=3

Topic Closed

This topic has been closed to new replies.

About this Topic