I'm working on a thorny mod_rewrite problem. I have a mac connected to my LAN running MAMP (Mac/Apache/MySQL/PHP).
I request a non-existent file:
Code:
http://192.168.1.2:8888/careers/db/1.html
I see this in the mod_rewrite log file:
Code:
192.168.1.102 - - [14/Nov/2009:13:46:07 --0800] [192.168.1.2/sid#807df8][rid#8ec850/initial] (2) init rewrite engine with requested uri /careers/db/1.html
192.168.1.102 - - [14/Nov/2009:13:46:07 --0800] [192.168.1.2/sid#807df8][rid#8ec850/initial] (1) pass through /careers/db/1.html
Note that the requested uri is /careers/db/1.html
If I change just the file extension on my request to PHP like so:
Code:
http://192.168.1.2:8888/careers/db/1.php
Then the request uri is totally different now. Here's the rewrite log:
Code:
192.168.1.102 - - [14/Nov/2009:13:47:23 --0800] [192.168.1.2/sid#807df8][rid#8fc850/initial] (2) init rewrite engine with requested uri /Applications/MAMP/htdocs/careers/
192.168.1.102 - - [14/Nov/2009:13:47:23 --0800] [192.168.1.2/sid#807df8][rid#8fc850/initial] (1) pass through /Applications/MAMP/htdocs/careers/
Note that the requested uri now has a full path which does not include the actual filename, /Applications/MAMP/htdocs/careers/
What the heck?
More info. If I request
http://192.168.1.2:8888/careers/db/p1.php, I can actually access p1.php. The requested uri is /careers/db/p1.php.
The problem appears to be because the filename starts with a number. I can also request
http://192.168.1.2:8888/careers/db//1.php and get thru to 1.php with requested uri /careers/db//1.php.
This seems like a bug to me. Does mod_rewrite think /1 refers to a backreference or something?? Why can apache handle the html file request properly and not the php file request? This is very very annoying. I hope I'm not missing something obvious here.