WordPress.org

Ready to get started?Download WordPress

Forums

Logic behind /wp-content, /wp-includes, etc. (7 posts)

  1. mcg1969
    Member
    Posted 2 years ago #

    I have multisite installation running successfully on my site with one main site and two subdirectory sites. I'm using nginx, so I've had to make myself pretty familiar with the necessary rewriting rules to get things up and running. I even have W3TC running to my satisfaction on all three sites.

    I remain puzzled about one thing: why do the subdirectory blogs insist on accessing wp-content/, wp-includes/, etc. through their subdirectories? In other words, why does my home site access it as /wp-content/ and my "cvx" site access it as /cvx/wp-content/, when it's the same data? Why force the web server to strip out the subdirectory? Why not just construct WP_CONTENT_URI to point to "/wp-content" in the first place?

    I guess it's not that big of a deal in a vanilla WordPress installation, but it does mean I have duplicate copies of WP's static content out there on my CDN, and under certain circumstances visitors to my sites will grab duplicate copies of that content.

    It seems like it would be relatively easy to override the code that constructs WP_CONTENT_URI, etc. to eliminate the "unnecessary" subdirectories. But that's just it, I can't read the minds of the WordPress developers, and there may be some logic behind this design choice that I'm missing. Can anyone illuminate that for me?

  2. why do the subdirectory blogs insist on accessing wp-content/, wp-includes/, etc. through their subdirectories? In other words, why does my home site access it as /wp-content/ and my "cvx" site access it as /cvx/wp-content/, when it's the same data?

    It's virtual. there should be no physical directory anywhere.

    IF you do have duplicates on your cdn, that's an issue with whatever you used to do that. (I do not use one)

  3. mcg1969
    Member
    Posted 2 years ago #

    Thanks for the reply. And yes, I see that. But I don't think that really addresses the question.

    Why are they specified differently at all? What's the logic there? Why couldn't WP_CONTENT_URI be set to the same value, say "/wp-content", regardless of which multisite subdirectory is being accessed? If WordPress anticipated that I would want my sites to access different WordPress installs, I could see it. But nothing I see in the code or documentation anticipates that. For instance, the default rewrite rules provided for Apache and NGINX explicitly strip off the subdirectory whenever a /wp- directory is requested.

    As for the duplicates in my CDN, sure, I can fix that. One easy way to do that would be for me to explicitly force WP_CONTENT_URI, WP_INCLUDES_URI, etc. to be the same across all of my sites---strip out the subdirectories. And so I'm asking: is there a reason I'm missing why I shouldn't do that?

    I could also hack W3TC to map /wp-content, /cvx/wp-content, and /tfocs/wp-content to the same directory on my CDN. But that's more cumbersome than overriding WP_CONTENT_URI so WordPress requests /wp-content in all three cases.

    I certainly hope I do not sound ungrateful; I concede these may seem like the rantings of an obsessive-compulsive type :P WordPress is working brilliantly for me right now.

  4. Why are they specified differently at all? What's the logic there?

    Badly coded themes and plugins, that ASSUME you're always gonna have wp-content there. It's a relative location, and the assumption most people make is that it's there. So ... CYA :)

  5. Why are they specified differently at all? What's the logic there?

    Because users get hella confused. :P

    Look at wordpress.com - now go to any blog on their system and look at the source.

    Can you imagine if half those references were all to the one address?

    I'm just guessing here - this decision was made a looong time before I got here. I suspect its "because that's the way it is".

  6. mcg1969
    Member
    Posted 2 years ago #

    "because that's the way it is"

    Honestly, I can accept that answer :P

    So I went to a blog on WordPress.com, and looked at the source. I'm seeing clear evidence of both the customization of both the content/plugin/include locations, AND the use of a CDN for static content. Of course, these are either subdomain blogs or custom domains altogether, but still: it gives me confidence I'm not going to completely bork things if I tidy up a bit.

    Thanks for all the help!

  7. Yeah, there wp-config directives to change the entire wp-content location.

Topic Closed

This topic has been closed to new replies.

About this Topic