WordPress.org

Forums

WP sets 404 on external files (1 post)

  1. Chris Burgess
    Member
    Posted 8 years ago #

    I was having problems with WP setting a 404 on an external js.php file which sits in my wp-content/themes/paperfish directory.

    This made it work OK in Safari and Opera, but not OK in Firefox / IE.

    I found a crude fix, but I'd like to know if there's a better one.

    This code would result in a 404 header being set (and the file parsing correctly, but being ignored by the browser due to the 404 header):
    <?
    define('WP_USE_THEMES', false) ;
    require('../../../wp-blog-header.php'); // i'm in wp-content/themes/js.php
    ?>

    I found this workaround, but I'd rather do it The Right Way.

    <?
    define('WP_USE_THEMES', false) ;
    require('../../../wp-blog-header.php'); // i'm in wp-content/themes/js.php
    header("HTTP/1.1 200 OK"); // else we get 404
    header("Status: 200 All rosy") ; // what should this really say?
    ?>

    Example:
    http://paperfish.co.nz/paperfish/wp-content/themes/paperfish/paperfish-js.php
    http://paperfish.co.nz/paperfish/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.