Support » Plugin: WP Super Cache » Issues with the server_name directory in /supercache/

  • Hi Donncha,

    I really need your help here please.

    I have three web servers on the same network. They are constantly synchronized, so no issues have arisen from this for the past year.

    I have two websites running on these servers – and They are identical as far as the wp-config.php file goes, as far as plugins go, etc. They are also identical as far as their httpd.conf vhost goes.

    Yet despite this, if I look at /wp-content/cache/supercache/ this is what I get for one:

    [apache@xxxxxx supercache]$ ls -l
    total 352
    drwxr-xr-x 5401 apache toi 356352 May 16 20:20
    [apache@xxxxxx supercache]$

    And this is what I get for the other:

    [apache@xxxxxx supercache]$ ls -l
    total 2340
    drwxr-xr-x     2 apache toi    4096 May 16 20:15
    drwxr-xr-x     5 apache toi    4096 May 16 20:14
    -rw-------     1 apache toi  434512 May 16 20:09 index.html
    -rw-------     1 apache toi   65212 May 16 20:09 index.html.gz
    drwxr-xr-x 19600 apache toi 1871872 May 16 20:25
    [apache@xxxxxx supercache]$

    (I masked the IP and stuff in the lines above)

    I made sure that the ServerName is correct and that UseCanonicalName is On. Yet despite this, it ignores the server_name in one and doesn’t in the other.

    The multiple directories for is causing me problems – users don’t always get served the correct page version, etc. I delete these directories but they come back.

    I tried editing .htaccess for, replacing /wp-content/cache/supercache/%{SERVER_NAME}/ with /wp-content/cache/supercache/ — but that made no difference at all.

    Could you please advise me what to do? I’m maxed out on ideas and it’s a rather urgent issue for us.

    Thank you,


Viewing 6 replies - 1 through 6 (of 6 total)
  • I think the problem is that you may be using HTTP_HOST instead of SERVER_NAME in some places. Is that possible?


    This is my guess of what the problem is, and how to fix it:

    In wp-cache-base.php you have a line:

    $WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );

    I think this should be:

    if ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) {
    	$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );
    } else {
    	$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'SERVER_NAME' ] );

    Yeah, I mentioned this to Donncha before. He fixed some of them, but not all of the places where HTTP_HOST is used.

    I get case-sensitive named directories too.

    Hi jondaley,

    Yes, I used to get case sensitive and spelling errors too 🙂

    Anyway, I commented out the line

    $WPSC_HTTP_HOST = htmlentities( $_SERVER[ ‘HTTP_HOST’ ] );

    And changed it to

    $WPSC_HTTP_HOST = htmlentities( $_SERVER[ ‘SERVER_NAME’ ] );

    And that absolutely fixed my issue…

    Now I just hope Donncha includes this (or the above solution I gave him) in the next release, so I don’t have to edit this file every time 🙂



    I’ve been getting lots of weird cached directories on one of my sites – it is the default site for this particular IP address, and apparently, it is some sort of weird spammer thing to try to pollute caches or something? They are sending their own HTTP_HOST in the request, and then supercache creates a directory with their hostname (or IP address).

    I’ll try your fix and see how that works for me.

    Now looking at the code I see that your fix would not work in a multi-site installation, or at least in some cases within a multi-site installation, because there would be cache collisions among different blogs, and so the HTTP_HOST is needed in that case.

    But, for me, I haven’t gotten the multi-site installations to work very well in wordpress anyway, so it looks like your fix is good.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Issues with the server_name directory in /supercache/’ is closed to new replies.