View Full Version : Apache: redirect if dir doesn't exist

10-29-2003, 11:05 AM

I was wondering if there is a way to achieve the following:

If someone enters the following url: 'www.mydomain.com/test/', while the directory 'test' does not exist, the page page 'redirect.php' should be opened, which in turn should search for the page 'test.php' in the directory 'content'. If that page exists, it should be included in 'redirect.php'. When a directory does exist, this shouldn't happen.

If possible I'd like the url 'www.mydomain.com/test/' to stay visible in the addres-bar. My goal to be able to use 'friendly urls' without having to create different directories for each page.

To achieve this, probably something in .htacces should be altered, but I am a total newbie in this area.

Thanx in advance, Michiel