- Code: Select all
# use mod-rewrite for development. If this is the development server,
#look
# for FileName.php.dev when FileName.php is requested, if
#FileName.php.dev
# does not exist, then use FileName.php.
RewriteRule ^(.*)\.php$ $1 [C,E=isPHP:yes]
# check to see if FileName.php.dev exists
RewriteCond %{REQUEST_FILENAME}.dev -f
# FileName.php.dev does exist, so redirect to it
RewriteRule ^(.*)$ $1.php.dev [S=1]
# FileName.php.dev does not exist, so try to revert to the originally
# requested file
RewriteCond %{ENV:isPHP} ^yes$
RewriteRule ^(.*)$ $1.php
The code is nearly identical to the example at http://httpd.apache.org/docs/misc/rewriteguide.html for
Backward Compatibility for YYYY to XXXX migration
The problem seem sdo be the RewriteCond %{REQUEST_FILENAME}.dev -f isn't evaluating to TRUE when it should be.
I have some other rewrite rules above this, so I am not sure if that requires me to do anything differently. For instance, I assume I still reference $1 as the first pattern matched, even though I have another $1 in the previous rule (which doesn't use the [C] chain directive).
Is there a good way to print out the value of %{REQUEST_FILENAME}?
Thanks!!!!