Page 1 of 1
How do block a particular file extension ?
Posted: Thu Feb 03, 2005 8:10 am
by anjanesh
How do block a particular file extension ?
If I have a files names with extension .fun which contain various functions then what do I have to do so that when someone enters xxx.fun it'll not appear ?
Other than in localhost, how'll I do in my host ?
Thanks
Posted: Thu Feb 03, 2005 9:57 am
by feyd
store them as .php, do not output any data in the files.
Posted: Thu Feb 03, 2005 11:39 am
by anjanesh
Thats true but I wanted to differentiate b/w php files and my include files so that it'll be easier for me for oranization. In IIS6 all file extensions except html,htm,asp,aspx etc are blocked unless we add them as we do for php. But hows that done for Apache and esp on a host ?
Posted: Thu Feb 03, 2005 11:55 am
by feyd
.func.php maybe?
Posted: Thu Feb 03, 2005 12:34 pm
by anjanesh
I've already made a site with lots of .fun and lots of .php pages calling .fun files. Plus there are some .include files which do output. Changing all those extensions and all the files calling those include files is tedious. Anyway to stop .fun from loading as in IIS6/5.1. Since Im using IIS5.1 which doesnt allow you to type in just any extension I got used to it.
Posted: Thu Feb 03, 2005 12:44 pm
by feyd
then add types that are those file extensions.. make them php parsed files.
Posted: Thu Feb 03, 2005 1:07 pm
by anjanesh
How abt .inc files ? I just tested one inc file and Apache seems to be parsing it as php as the php code of the inc file didnt show up - the output did. Is it standard ?
Posted: Thu Feb 03, 2005 1:16 pm
by feyd
if they are php parsed files, php will parse them, so yes.
Posted: Thu Feb 03, 2005 1:29 pm
by anjanesh
Strange.
Code: Select all
<?php
$a=1;
$b=2;
$c=$a+$b;
echo $c;
?>
If its named test.php.inc it outputs 3.
If its named test.inc it outputs the entire code rendered as a text file.
Posted: Thu Feb 03, 2005 1:42 pm
by magicrobotmonkey
apache will only parse files with .php (or php3?) by default. There are various means you can use to cblock other files either by attempting to parse them or refusing to serve them. IF you look through your httpd.conf file, there should be some comments in there explaining what you need to do.