# Problem with .htaccess 404 redirect

**URL:** <https://forum.kirupa.com/t/problem-with-htaccess-404-redirect/238723>\
**Category:** programming\
**Created:** [September 14, 2007, 9:04am UTC](https://forum.kirupa.com/t/problem-with-htaccess-404-redirect/238723 "2007-09-14T09:04:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjitt](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@bjitt](https://forum.kirupa.com/u/bjitt)\
**Post date:** [September 14, 2007, 9:04am UTC](https://forum.kirupa.com/t/problem-with-htaccess-404-redirect/238723/1 "2007-09-14T09:04:38Z")

</div>

Hi,

I’m using the following code to do a 404 redirect…

```auto
ErrorDocument 404 index.php

```

BUT when I go to execute a nonexistent file, the browser simply outputs “index.php” — that’s it.

If I change the code to redirect to an external website like yahoo, that works just fine –

```auto
ErrorDocument 404 http://yahoo.com

```

But why isn’t my own page being executed?

Thanks.
