PHP Files and 404/.htaccess Problem (6 posts)

  1. Amulet
    Posted 9 years ago #

    A user on another (non-WordPress-related) forum posted about an error he (or she) was having where he created a custom 404 error page and pointed to it with the .htaccess file. His problem was, while the error file came up fine if a user typed in a path to a false .htm file, a different page came up for false .php files, a white page that only had the text, "No input file specified." I found that this was the case for me, too: Typing in "http://www.sassydevil.com/blue.htm" or "http://www.sassydevil.com/blue" brings up the correct file, but "http://www.sassydevil.com/blue.php" does not.

    I tried the solution in the forum, to put the code below into the .htaccess file, but it didn't work for me:

    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteRule (.+) /404.html

    I even tried changing the "404.html" to "404.php," since my 404 file is a php file. I tried putting this below the code I have below the WordPress rewrite stuff, which is this:

    # END WordPress

    ErrorDocument 404 /index.php?error=404
    ErrorDocument 403 /index.php?error=403
    Options All -Indexes

    Can someone tell me what I need to do? Thanks.

  2. Usayd
    Posted 9 years ago #

    just a note - mod_rewrite is active on the server right?

  3. Amulet
    Posted 9 years ago #

    Yes. All the other rewrite rules work fine.

  4. vsa
    Posted 9 years ago #

    Same problem here... any help would be useful

  5. James Huff
    Volunteer Moderator
    Posted 9 years ago #

    Since you already have ErrorDocument 404 /index.php?error=404 listed, you shouldn't need RewriteRule (.+) /404.html . Does it work properly if you remove that line?

  6. Austin Matzko
    Posted 9 years ago #

    Maybe I don't understand what you're trying to do, but why don't you put the 404.php file in your theme directory? Then WordPress should automatically call it for "error" requests.

    See http://codex.wordpress.org/Creating_an_Error_404_Page

Topic Closed

This topic has been closed to new replies.

About this Topic