note 78013 added to security.hiding
| From: | Raz at osu1 dot php dot net | Date: | Mon, 24 Sep 2007 10:07:31 +0000 |
| Subject: | note 78013 added to security.hiding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130741@lists.php.net to get a copy of this message | ||
May some servers not allow you to put this line (i.e this not work)
AddType application/x-httpd-php .asp .py .pl
or
DefaultType application/x-httpd-php
so, the alternative method that really a good one is:
1- In your .htaccess file write:
RewriteEngine on
RewriteBase /dire/ or just /
RewriteRule securename yourfile\.php [T=application/x-httpd-php]
example: all url like
www.example.com/securename parsed as
www.example.com/yourfile.php
2- but here the $_GET not work, but $_POST work, so for dynamic pages like
www.example.com/yourfile.php?page=1 you use
www.example.com/securename?page=1
now: instead of using $_GET use
<?php
$uri = $_SERVER['REQUEST_URI'];
$page = strstr($uri, '=');
$page = substr($page, 1);
$valid_pages = array('1', '2','...');
$page = in_array($page, $valid_pages) ? $page : '1';
//....
?>
and for bad URL you can add this code to .htaccess file
of coarse below the first code in .htaccess
#--
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ http://www.example.com/securename
[L]
----
Server IP: 69.147.83.197
Probable Submitter: 207.226.41.22 (proxied: 207.226.41.22)
----
Manual Page -- http://www.php.net/manual/en/security.hiding.php
Edit -- https://master.php.net/note/edit/78013
Del: integrated -- https://master.php.net/note/delete/78013/integrated
Del: useless -- https://master.php.net/note/delete/78013/useless
Del: bad code -- https://master.php.net/note/delete/78013/bad+code
Del: spam -- https://master.php.net/note/delete/78013/spam
Del: non-english -- https://master.php.net/note/delete/78013/non-english
Del: in docs -- https://master.php.net/note/delete/78013/in+docs
Del: other reasons-- https://master.php.net/note/delete/78013
Reject -- https://master.php.net/note/reject/78013
Search -- https://master.php.net/manage/user-notes.php