note 72630 added to security.hiding

From: Date: Fri, 26 Jan 2007 20:05:35 +0000
Subject: note 72630 added to security.hiding
Groups: php.notes 
Request: Send a blank email to php-notes+get-122242@lists.php.net to get a copy of this message
So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase. .htaccess: RewriteEngine on # Rewrite /foo/bar to /foo/bar.php RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L] # Return 404 if original request is /foo/bar.php RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" RewriteRule .* - [L,R=404] # NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this: # RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC] ---- Server IP: 69.147.83.197 Probable Submitter: 145.116.15.149 ---- Manual Page -- http://www.php.net/manual/en/security.hiding.php Edit -- https://master.php.net/note/edit/72630 Del: integrated -- https://master.php.net/note/delete/72630/integrated Del: useless -- https://master.php.net/note/delete/72630/useless Del: bad code -- https://master.php.net/note/delete/72630/bad+code Del: spam -- https://master.php.net/note/delete/72630/spam Del: non-english -- https://master.php.net/note/delete/72630/non-english Del: in docs -- https://master.php.net/note/delete/72630/in+docs Del: other reasons-- https://master.php.net/note/delete/72630 Reject -- https://master.php.net/note/reject/72630 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122242) next »