Forum Moderators: phranque

Message Too Old, No Replies

htaccess or rename pages

which is best?

         

Tiebreaker

4:14 pm on Oct 30, 2004 (gmt 0)

10+ Year Member



Hi

I am about to start using includes on my site, which has all .html pages.

I know that all I have to do is add some code to my .htaccess file to make this work - and I know that this adds a little server load - but does this method add MORE server load than just renaming my pages as .shtml

If I do decide that renaming my pages is best, I am also considering changing them to .php - so that I can use php includes (plus other php stuff as well) - if php pages cause less server load than .shtml

jdMorgan

1:27 am on Oct 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I know that all I have to do is add some code to my .htaccess file to make this work - and I know that this adds a little server load - but does this method add MORE server load than just renaming my pages as .shtml

No. Save yourself some work, and just use AddHandler to enable parsing of .html files for SSI includes.

> If I do decide that renaming my pages is best, I am also considering changing them to .php - so that I can use php includes (plus other php stuff as well) - if php pages cause less server load than .shtml

It really depends on specifically *what* the include does. Whether CGI, or PHP, efficent code is good, and inefficient code is bad. It's always good to be aware of server loading, and to write your scripts to be as efficient as possible, but remember that there are very large major sites on the Web that are almost completely dynamic, and that they perform just fine. As your visitors/day goes up above, say, 50,000, the performance becomes more of a concern and may call for some investment of your profits (or corporate budget) into a dedicated server. Don't waste your CPU on poorly-written, inefficient code. But on the other hand, it's the server CPU's *job* to do the work needed to save you time!

Jim

Tiebreaker

8:08 am on Oct 31, 2004 (gmt 0)

10+ Year Member



Jim

thanks for the reply.

> No. Save yourself some work, and just use AddHandler to enable parsing of .html files for SSI includes.

I often read comments that using AddHandler in your .htaccess file is a clumsier way of doing it, because it will cause ALL .html files to be parsed - even if they don't have includes.

That is a fair comment, but if ALL of your pages have includes, then they all need to be parsed anyway.

So in this circumstance, is the AddHandler method EXACTLY the same as just having .shtml pages, in terms of server load - or is there some difference to the way the server will handle the situation?

I ask because I need to add includes to several thousand pages - so server load might be a slight issue for me in the future.

As far as the php goes ...

My includes will mainly be plain html headers and footers etc - with some adsense code

But I also have vague plans to start using MySQL in the future, so changing files to .php would 'future proof' the site in case of this eventuality - as well as solve my current includes problem.

So php pages give me more options than shtml pages - but I'm just interested to know whether php pages also have a lower server load than shtml pages (assuming the content on the page is the same of course).

jdMorgan

9:52 pm on Nov 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> So in this circumstance, is the AddHandler method EXACTLY the same as just having .shtml pages, in terms of server load - or is there some difference to the way the server will handle the situation?

Exactly? No. But the server does not behave in any fundamentally different way when parsing .html files for SSI than it would if it was configured to parse .shtml files for SSI. And it does have to be configured somewhere to do this. The main performance-affecting difference is that you are doing the configuring on a per-request basis in .htaccess, rather than once at start-up in httpd.conf. And this difference remains whether you use CGI or PHP.

As to the difference between CGI and PHP, it could well come down to your coding style. If you want hard numbers, you'll have to do some benchmark testing.

Jim