ajbest 0 Light Poster

You will have to excuse if this question seems stupid but while I am a fairly skilled PHP developer I am a total newb when is comes to apache and server config.

I am trying to have a single page accept all the request for directories on my site unless the requested directory actually exists. The most common example I see of this is in wordpress though I cannot figure out how wordpress is actually acomplishing it. This is probably best communicated through example

say some one requests


simple, apache gives them my index.php file. Now lets say someone requests


yet there is no directory on my server called /post/ .What I would like is for that request to be redirected back to


yet I still want the user to see their original request in the URL bar of


my index.php page will then parse that variable 'request' and deliver the apropriate content to the visitor.

now there is one other consideration and that is for directories that do exist such as the /images directory. I need to be able to still serve my images dir requests or any other dir that exists. So if some one requests


The image that exists at that location would be delivered.

From what I have found this should require just the .htaccess file to handle all server requests. This is what I have thus far.

RewriteEngine on
RewriteRule ^(.*)$ http://mydoamin.com/index.php?request=$1

This however results in a continuous loop of the server looking for index.php

Any helpful direction on this would be very appreciated. I have looked through a number of mod Rewrite explanations but cannot get this figured out