Forum Moderators: coopster

Message Too Old, No Replies

.html or .php

Which is best...

         

madcat

10:09 pm on Sep 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's up-

I'm having some confusion as to when you would use a .php extension on your Web pages. I've read that it is best to change your pages to .html even when you're using php. So I've made all of my pages .html and used .htaccess to allow php within those pages. For what reasons is this method better?

Instead of using .htaccess, could I just use mod_rewrite? Which way is better- or do I have it all wrong ;)

Help@-)

oilman

10:25 pm on Sep 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I doesn't matter - php is executed server side so spiders only get the regular html that is output. Google swears up and down that file extensions don't make an ounce of difference. That said I always go with html if I can. The htaccess method is perfectly fine for this.

Friday

10:43 pm on Sep 12, 2003 (gmt 0)

10+ Year Member



I have to agree with oilman.
I just like .html because it makes the site look consistent and nobody has to know "HOW" my sites do the "magical" things they do.
;)
.htaccess works fine. I don't see any reason to use mod_rewrite, unless maybe you have several sites on a server and you don't want to keep creating new ,htaccess files for each one. Maybe it would be a couple of nanoseconds faster? I really don't know, not being a sysadmin.

oilman

10:59 pm on Sep 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the only reason I would use mod_rewrite is if I had to deal with more than one or two parameters in the urls

RobinC

11:02 pm on Sep 12, 2003 (gmt 0)

10+ Year Member



I'm considering renaming to *.html for a different reason - I prefer to edit my files in a plain text editor, but considering mozilla has an html editor built in I wanted to try it... lo and behold it doesn't want to open a php file as html... blah...

vincevincevince

7:57 am on Sep 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.html just looks better - and to be honest, it's a more valid descriptor of the content returned to the client... the client doesn't see php - the client can't even understand php if it reaches it - all the client ever sees is html - and so it's more proper to label it as .html

you'd not call your pictures Me_And_Fred.camera or John_Notes.scanner - you call them .jpeg or similar - named after the content, not after the way in which they were originally made ;-)

and there's a certain geek-clique who don't like php :p

killroy

9:39 am on Sep 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I never use any extensions, except for support fiels like images or stylesheets.

The reason? W3C recommendation. don't reveal the underlying technology, and the fact that it's html is stated in the Content-Type.

I think it just messes up the URLs and makes type-ins much harder.

SN

daisho

10:20 pm on Sep 13, 2003 (gmt 0)

10+ Year Member



killroy you took the works right out of my mouth. Everyone should look into Multi-Views feature of apache. Leave off extensions. Apache will pick the best resource with that name (or the only resource). That way it can be a .html page today (ie no serverside processing therefore no server impact) and tomorrow it can be a PHP file if you needs change and maybe 5 years from now an ABC file that's the new wizbang language of the day all the while your URI stays the same.

daisho

madcat

6:40 pm on Sep 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Interesting- thanks for the word up on that...