Tip: Use PHP_SELF and mod_rewrite without using .htaccess

January 23rd, 2009 | Tags: , , , ,

Want to use your favorite PHP framework without it’s .htaccess file by moving those settings into your httpd.conf but it’s not quite working out? This is probably because some of those settings in the .htaccess file are rewrites and the PHP framework you are using uses a front controller that relies on the PHP_SELF server variable. When you moved those rewrites into the httpd.conf file, PHP_SELF doesnt get populated correctly by Apache. To workaround this issue simply give each RewriteRule the PT (passthrough) flag (as pointed out in https://issues.apache.org/bugzilla/show_bug.cgi?id=40102#c11). This works well for Elgg and Symfony—I’ll post more detailed instructions for those two popular frameworks soon.

No comments yet.