• Resolved CanSpice

    (@canspice)


    For the past day, my WordPress blog (canspice.org) has been displaying bizarre stylesheet behaviour. It won’t. The stylesheet, even though it’s in the right place, doesn’t get served. If I move the stylesheet to the root directory and try to load it directly (i.e. https://www.canspice.org/style.css) I get my WordPress 404 page. I copied the stylesheet in the root directory to style.txt and that gets served properly.

    I haven’t changed anything recently. I was originally running 2.6.1 when this problem started happening, then I updated to 2.6.3 and the problem is still happening.

    Anybody have any ideas on where I should look to try to fix this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You have code errors, including one in your stylesheet link code. Your theme uses a HTML 4.01 Transitional doctype, while WordPress uses XHTML, which might be causing problems.

    https://codex.www.ads-software.com/HTML_to_XHTML

    Thread Starter CanSpice

    (@canspice)

    I have changed doctypes to XHTML and fixed the stylesheet link to include the closing slash (and tried to fix as many of the other errors, but can’t because WP enjoys sticking tags in where they don’t belong), but this does nothing to fix the problem. If I try to load the stylesheet through my browser, I get redirected to my WP 404 page.

    Your stylesheet loads okay and your site looks fine to me (Mac Firefox). Try refreshing your browser, emptying your browser cache, and/or disabling any WordPress caching plugins (if you are using one).

    Thread Starter CanSpice

    (@canspice)

    After poring through logs and with the help of my web provider, I’ve figured it out.

    The Apache server runs mod_security, which is set up to look through URIs and HTTP_REFERERs and whatnot, trying to match malicious strings to keep the server safe.

    I recently posted a story whose permalink URI contained “python-“, which happens to match one of the regular expressions mod_security tests.

    When you load a page, the HTTP_REFERER for the stylesheet for that page is that page’s URI, so the HTTP_REFERER for the stylesheet for the “python-” post contained “python-“, so mod_security said “OH NO YOU DON’T” and returned a 404 for the stylesheet.

    Then because Apache is smart, on subsequent reloads of any page (whose URI does not contain “python-“), the HTTP return code for the stylesheet is 304, meaning it hadn’t changed, which is correct. In combination with the previous pseudo-404, some browsers wouldn’t reload the stylesheet, and thus all pages loaded after the “python-” page was loaded would appear in their “raw” unstyled form.

    I “fixed” this by changing the permalink of the Python post to be “pythons-” instead of “python-“. This means it doesn’t trip the mod_security regular expression, and everything goes on just fine.

    What a funny problem. ??

    And now at least I’m serving up XHTML too. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WordPress won’t serve up stylesheet’ is closed to new replies.