Page 1 of 1

htaccess newb: if file !exists, redirect...

Posted: Sat Jan 22, 2005 11:53 am
by The Monkey
Hello there,

I would like an htaccess script that, when someone goes to mysite.com/foobar.html, checks to see if the file foobar.html exists, and if it DOESN'T, tell it to display pagefromdb.php?page=foobar.html (while leaving the url in the browser as mysite.com/foobar.html).

Here is what I need in pseudo code:

Code: Select all

if file exists {this_page} == false
display pagefromdb.php?page={this_page}
else
display {this_page} //file
Could one of you point me in the right direction for what I need to do?

I hope I was clear enough...

- Monkey

Posted: Sat Jan 22, 2005 12:32 pm
by feyd
look at the mod_rewrite thread just below this.