note 30751 added to security.hiding
| From: | Bryce at rack1 dot php dot net | Date: | Thu, 27 Mar 2003 14:24:53 +0000 |
| Subject: | note 30751 added to security.hiding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45904@lists.php.net to get a copy of this message | ||
Using the .php extension for all your scripts is not necessary, and in fact can be harmful (by
exposing too much information about your server, and by limiting what you can do in the future
without breaking links). There are several ways to hide your .php script extension:
(1) Don't hard code file types at all. Don't specify any dots, and most web servers will
automatically find your .php, .html, .pdf, .gif or other matching file. This is called canonical URL
format:
www.xxxxxx.com/page
www.xxxxxx.com/directory/
This gives you great flexibility to change your mind in the future, and prevents Windows browsers
from making improper assumptions about the file type.
(2) In an Apache .htaccess file use:
RewriteEngine on
RewriteRule page.html page.php
(3) Force the webserver to interpret ALL .html files as .php:
AddType application/x-httpd-php .php3 .php .html
--
http://www.php.net/manual/en/security.hiding.php
http://master.php.net/manage/user-notes.php?action=edit+30751
http://master.php.net/manage/user-notes.php?action=delete+30751
http://master.php.net/manage/user-notes.php?action=reject+30751