note 43206 deleted from security.hiding by victor

From: Date: Mon, 14 Jun 2004 15:00:08 +0000
Subject: note 43206 deleted from security.hiding by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71050@lists.php.net to get a copy of this message
Note Submitter: tmpa@yahoo.com ---- ldemailly at qualysNOSPAM dot com: > adding MultiViews to your apache Options config lets you hide/omit .php in the url without any rewriting, etc... in my situation, i unknowingly had MultiViews enabled for my web directory on my test server which was causing problems for my RewriteRules. i ignored it until i wanted to implement a caching system. i have a bunch of rewrite rules that redirect what looks like a directory to the actual php address e.g. RewriteRule ^courses/?$ courses.php RewriteRule ^courses/([A-Za-z0-9_]+)/?$ courses.php?d=$1 [T=application/x-httpd-php,L] RewriteRule ^courses/([A-Za-z0-9_]+)/([A-Za-z0-9_]+)/?$ courses.php?d=$1&c=$2 [T=application/x-httpd-php,L] RewriteRule ^faculty/?$ faculty.php RewriteRule ^faculty/([A-Za-z0-9_]+)/?$ faculty.php?f=$1 [T=application/x-httpd-php,L] RewriteRule ^faculty/([A-Za-z0-9_]+)/([A-Za-z0-9_]+)/?$ faculty.php?f=$1,$2 [T=application/x-httpd-php,L] this makes it perfect to make an actual directory and stick an index.html in it that is a cached version of the actual page. using RewriteCond %{REQUEST_FILENAME}/index.html -s RewriteRule ^(.*[^/]{1})/?$ $1/index.html i think this might need to be before any other rewrite rules if there is an index.html, apache serves it, otherwise it calls the php script. note that the script needs to output to the browser as well as write to a file, perfect use for output buffering -tim

« previous php.notes (#71050) next »