Page 1 of 1

Extensions

Posted: Mon Nov 14, 2005 11:12 pm
by Covenant
In my .htaccess file, I added this line:

Code: Select all

AddType application/x-httpd-php .beans
Then I renamed all my files (aboutme.php, guestbook.php, blog.php) to the new extension (aboutme.beans, guestbook.beans, blog.beans).

Does anyone know if personalizing your extensions like this poses any problems for certain browsers or computers? That is, compatibility errors? Does it affect PHP & MySQL in any way? I like it with the new extension and I would like to make sure that every user can properly view my site.

And also, is this the only thing you need to do to change the extension (there's nothing further, like adding ".beans" to some other sort of configuration file).

Posted: Mon Nov 14, 2005 11:30 pm
by trukfixer
Well it *will* affect your server insofar as apache - every .htaccess file forces apache to look up and scan all parent directories all the way to document root.. so if you have a document root like /var/www/html and in that directory you put a .htaccess file for one thing, and then you have a directory of /var/www/html/project/members/images/protected and put .htaccess in the /protected folder, then apache is gonna have to scan all the way back through every single folder for any additional .htaccess files... so Ideally, .htaccess should only be used in the document_root where possible.. and in sub directories as sparingly as possible..

In your case, if you have your .htaccess file stored in DOCUMENT_ROOT , you should be just fine, and the impact to the server should be relatively negligible.. It would only become a consideration if you experience Extremely High Traffic .. whe a machine has enough traffic to be pushing 40 - 50 Mbps then you're gonna start seeing a definitive impact on your server's performance scaling up above and beyond that level of traffic... (Ive actually watched a server's load drop from 4.80 to 0.98 continuous 5 and 15 nminute average, while watching bandwidth increase from 46 Kbps to 57 Mbps in less than 2 minutes merely by removing a .htaccess file being used as a "deny from all" protection in a directory 3 levels into document_root.. I couldnt believe it at the time... my employer wanted me to watch as a demonstration so I could learn something about dealing with a high traffic environment)

In a nutshell, you should be fine, unless you're running a Yahoo or Google lookalike.. just keeep in mind for every .htaccess file, you're making apache take a performance hit.. :)

Posted: Mon Nov 14, 2005 11:45 pm
by Covenant
trukfixer wrote:Well it *will* affect your server insofar as apache - every .htaccess file forces apache to look up and scan all parent directories all the way to document root.. so if you have a document root like /var/www/html and in that directory you put a .htaccess file for one thing, and then you have a directory of /var/www/html/project/members/images/protected and put .htaccess in the /protected folder, then apache is gonna have to scan all the way back through every single folder for any additional .htaccess files... so Ideally, .htaccess should only be used in the document_root where possible.. and in sub directories as sparingly as possible..

In your case, if you have your .htaccess file stored in DOCUMENT_ROOT , you should be just fine, and the impact to the server should be relatively negligible.. It would only become a consideration if you experience Extremely High Traffic .. whe a machine has enough traffic to be pushing 40 - 50 Mbps then you're gonna start seeing a definitive impact on your server's performance scaling up above and beyond that level of traffic... (Ive actually watched a server's load drop from 4.80 to 0.98 continuous 5 and 15 nminute average, while watching bandwidth increase from 46 Kbps to 57 Mbps in less than 2 minutes merely by removing a .htaccess file being used as a "deny from all" protection in a directory 3 levels into document_root.. I couldnt believe it at the time... my employer wanted me to watch as a demonstration so I could learn something about dealing with a high traffic environment)

In a nutshell, you should be fine, unless you're running a Yahoo or Google lookalike.. just keeep in mind for every .htaccess file, you're making apache take a performance hit.. :)
Ah, thank you for clearing that up.

Oh, but wait, what if the .htaccess file was already there? I used cPanel so there was already a .htaccess file in the public_html directory. Will adding that one line affect apache's performance that much? :(

*EDIT* Oh, and also, nice site you have there (crazybri.net).

Posted: Tue Nov 15, 2005 11:06 am
by Covenant
Before I make this switch (renaming ALL my files from .php to my own extension, I'm not actually using .beans),

1) Does it compromise security? Will changing the extension EVER SOMETIMES cause pages to not be parsed (like .txt or .inc files) so people would be able to see all my code?
2) Is there a problem uploaded and downloading files (say, via FTP) with unknown extensions?
3) Are extensions limited to 3 or 4 letter words?
4) Why aren't personalized extensions more widely used... I see .html, .shtml, .php, .asp, etc. everywhere, but why isn't everyone making their own cool extensions? Is there some sort of hidden problem?