g1smd - 6:11 am on Jun 6, 2010 (gmt 0)
When the server rewrites the something.php URL request to the internal filepath foo.php, Mod_Rewrite starts again and foo.php also matches the pattern and is rewritten to foo.php, which matches the pattern and is rewritten to foo.php, which matches the pattern and it loops forever.
Add a negative match
RewriteCond $1 !^foo.php$ before the RewriteRule to fix this.
By the way, the pattern
^([0-9a-zA-z]*)\.php$ allows a URL request for
example.com/.php to be valid. The
* should be changed to
+ to prevent that happening.
However, I am not at all sure this code does what you want it to do, and I am not all that clear what it is that you actually want to do.
This code is an internal rewrite. It will accept a URL request for
example.com/<anything>.php and fetch the content from the file at
foo.php. The address bar will continue to show the originally requested URL.