473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

File name: foo.php OR foo.htm

Hello -

This has probably been asked before, but I would like to know when its
best to name a file with either extension.

Thanks,

- Olumide

Aug 19 '06 #1
6 1245
Hi,

On 2006-08-19 23:16:28 +0200, "Olumide" <50***@web.desaid:
This has probably been asked before, but I would like to know when its
best to name a file with either extension.
just as you like it. The browser typically does not look at the file
extension at all. Just the MIME content type of the file is important,
and that is controlled by the web server.
I think it is the best to name files with PHP code in it ".php" and
files without PHP code in it ".htm(l)" because that is the default and
should work on every webserver with PHP support.

Patrick

Aug 19 '06 #2
Olumide wrote:
This has probably been asked before, but I would like to know when its
best to name a file with either extension.
Typically, your file will only be processed as PHP code if its extension is
".php". Therefore, you should use that for all PHP files. HTML files will
probably be handled correctly if they are given the .php extension, but the
best practice is to use .htm (or, preferably, .html) if the file contains no
PHP code.

HTH,
--
Benjamin D. Esham
bd*****@gmail.com | AIM: bdesham128 | Jabber: same as e-mail
He has all the virtues I dislike and none of the vices I admire.
— Winston Churchill (attributed)
Aug 20 '06 #3
Olumide:

[re .htm and .php]
This has probably been asked before, but I would like to know when its
best to name a file with either extension.
I would say if the file or its output is text/html, name it .html. If
the file contains PHP code, intended to be parsed, name it .php. If
both, then both.

URLs, I would suggest not including any suffix.

--
Jock

Aug 20 '06 #4
Let's also consider some security issues...

It is never safe to reveal the technology behind the website; so, it is
safer not to show the .php extension (as well as .asp or .cfm etc...)
at all! mod_rewrite could help you.

Moreover, there are some mod_rewrite techniques that let you show the
..htm / .html extension instead of the .php / .asp etc.
--
unwiredbrain

Aug 20 '06 #5
un**********@gmail.com wrote:
Let's also consider some security issues...

It is never safe to reveal the technology behind the website; so, it is
safer not to show the .php extension (as well as .asp or .cfm etc...)
at all! mod_rewrite could help you.

Moreover, there are some mod_rewrite techniques that let you show the
.htm / .html extension instead of the .php / .asp etc.
--
unwiredbrain
And security by obscurity is worse than no security at all - you think
you have security but you don't.

If your site is secure, it doesn't matter what technology you use. And
if it's not secure, it doesn't matter how hard you try to obscure that fact.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 20 '06 #6
Jerry Stuckle wrote:
And security by obscurity is worse than no security at all - you think
you have security but you don't.
If your site is secure, it doesn't matter what technology you use. And
if it's not secure, it doesn't matter how hard you try to obscure that fact.
Yes, you're right. Of course there must be a robust and secure engine
behind, but...

Thanks to the hard work of php developers and sustainers, bugs in php
are found and solved quite daily; then, revealing the php technology
could be seriously dangerous if an attacker tries to deep scan (with
nmap, and similar tools) your host, allowing him to easily find which
php version the server is running and which attacks to use! Even if you
made a very robust and secure site...

IMHO, no one (except php.net, of course ;P) should reveal the
technology behind; moreover, you should do everything you can not to
allow anyone to guess which technology you're using.

Peace
--
unwiredbrain

Aug 24 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
14
by: Xah Lee | last post by:
Just bumped into another irresponsibility in perl. the crime in question this time is the module File::Basename. Reproduction: 1. create a directory containing a file of this name:...
4
by: M P | last post by:
Can you help me find an asp code that will upload a file from my PC to web server? Mark
8
by: Sam Collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8"...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
0
by: rautsmita | last post by:
hello friends , i am using to jdk6 and JAXB2.0, i have geomtry.xsd file i am trying to compile this file using jaxb but i got some error i.e.The particle of the type is not a valid restriction of...
1
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.