• I’m having a problem with any query to wp-rss2.php that comes via mod-rewrite generating a 404 http status code. However, the problem is a bit more complex than that. My test file setup will probably explain better:

    To show this error, I created a .htaccess in my home directory, as follows:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^foo/?$ /blog/wp-rss2.php [QSA,L]
    RewriteRule ^bar/?$ /test.php [QSA,L]

    If you are to load in a web browser, both a http://mroth.info/foo/ and http://mroth.info/bar/ appear to load normally. However, this is not the case. If you examine the headers, you will see the following:


    $ curl --head http://mroth.info/test.php
    HTTP/1.1 200 OK
    Date: Sat, 07 Jan 2006 22:06:09 GMT
    Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
    X-Powered-By: PHP/4.3.10
    Content-Type: text/html

    $ curl --head http://mroth.info/bar/
    HTTP/1.1 200 OK
    Date: Sat, 07 Jan 2006 22:01:40 GMT
    Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
    X-Powered-By: PHP/4.3.10
    Content-Type: text/html

    $ curl --head http://mroth.info/blog/wp-rss2.php
    HTTP/1.1 200 OK
    Date: Sat, 07 Jan 2006 22:02:43 GMT
    Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
    ETag: "1b073357af12abd921fea77ba1d7c443"
    X-Pingback: http://mroth.info/blog/xmlrpc.php
    X-Powered-By: PHP/4.3.10
    Last-Modified: Mon, 19 Dec 2005 03:49:23 GMT
    Content-Type: text/xml; charset=utf-8

    $ curl --head http://mroth.info/foo/
    HTTP/1.1 404 Not Found
    Date: Sat, 07 Jan 2006 21:23:44 GMT
    Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
    X-Pingback: http://mroth.info/blog/xmlrpc.php
    X-Powered-By: PHP/4.3.10
    Content-Type: text/xml; charset=utf-8

    So, in other words whereas the wp-rss2.php will load fine as itself, when called via redirect, it loads and displays fine, but returns a HTTP 404 status code, which causes many aggregators to break. The problem seems to be specific to that file, since as you can see the /bar/ redirect to a test .php file functions normally. Thus, the problem appears to be WordPress specific. This is causing large problems with aggregators for me, anyone have ideas?

Viewing 9 replies - 1 through 9 (of 9 total)
  • are you trying to redirect your feeds?

    Thread Starter mroth

    (@mroth)

    Yes, I need other URLs outside the WP directory that will refer (rewrite) to the wp-rss2 generated RSS feed, without a redirect.

    well, I don’t know if this will help you or not, but I had “similar” problem using feedburner and came up with this.

    Thread Starter mroth

    (@mroth)

    Thanks citeewurkor, but I’m afraid that doesn’t solve my problem. I’m aware how to write mod-rewrite rules, my problem stems from the fact that even when my rewrite rules are correct, the wp-rss2.php file appears to return an improper HTTP status code when URLs are rewritten to it. Since this seems to be a WordPress problem (bug?) rather than an Apache one (I believe), I’m not sure how to approach fixing it.

    It’s of little help, but you’re not alone…

    http://wordpress.org/support/topic/55663?replies=1

    When I hit (yes, foo.ca; literally) http://foo.ca/wp/feed/rss2 it’s fine, but not the /wp/wp-rss2.php… I thought it might have been a redirect, but it just doesn’t look like it’s the whole answer.

    It’s probably the fault of WP::parse_query() in classes.php, and it might have been fixed already. It’s 3am and I am too sleepy to test it, though.

    Thread Starter mroth

    (@mroth)

    Bug persists in version 2.0.1

    marcl

    (@marcl)

    I’ve just updated my site to use 2.0.2 and I have the same problem. My podcast RSS feed used to work using a rewrite rule as per the instructions on the codex but now all I get is a 404 error!

    Does anyone know of a workaround?

    After much digging through the code (note: I’m a PHP hacker, but this is my first experience hacking WordPress, so ymmv) I figured out where the problem is originating. Looks like the redirects you set by hand in .htaccess aren’t recognized by WP’s internal rewrite handling mechanism. I’m completely baffled as to why it even has such a mechanism, however, since my workaround was to simply shut off the internal redirect system.

    I’m using version 2.0.3 of WP. In wp-includes/classes.php on line 1486 (yow) you should see this:

    $rewrite = $wp_rewrite->wp_rewrite_rules();

    I commented this out so that $rewrite remains empty. This eliminated the 404 problem and does NOT seem to have affected anything else on the site. In addition, my theme’s custom 404 page still seems to kick in properly when an out of bound or otherwise bad request to the system is made.

    I;m hoping a WP developer out there is going to read this and, perhaps, give us a better workaround but, for right now, this is my plan of action and, so far, it’s workin’ for me.

    Rob Z.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Improper HTTP Status Code Returns’ is closed to new replies.