Html or php - default extension?

Hi all,

I am wondering what to set for my Default Extension in advanced settings for RW projects. Either html or php??

There have been a few threads on this but none recently and I’d like to get the current thinking on this please as I am a bit confused as to the best approach…especially for SEO.

Currently I am set to html as this seems to be the RW default setting but some pages automatically change it to php, which I understand is required for different stacks and is fine.

But what I’m unclear on…Is it best to just change all page extensions to php or it doesn’t matter at all what the page extension is…??

So then the question is…what is the advantages or disadvantages of html versus php extensions.

Thanks for all your wise words and advise.

Cheers Scott

The important setting is “tidy website links”.

More reading:

Hi Jannis,

Thanks, yes I had read about the “tidy website links” and I always keep that ticked.

But going back to my original questions…what about html or php?

Does it matter at all what the default extension is?

If you have ticked “tidy website links”, all your pages will either named index.html and index.php, and all URLs generated by RW will only contain the folder name, like

The page name is omitted from the URL, and the web server will by default serve first index.html from the folder, and if not available index.php. So SEO isn’t affected.

So, at the end it’s just an (for yourself) internal question what to do here. All you have to the care about is that not 2 both index.html and index.php files are available in one folder, because one is older than the new one.

Hope that helps.

I always set mine to php. So many pages need php for one thing or another and it saves you worrying about whether you have both a php and an html page.

Hi Peter,

Thanks, yes it seems that is the most logical way…but I don’t understand why RW put html as the default?

What…if any, are the disadvantages of using php as the default?

No disadvantages.

Remember there are web servers (like Amazon S3), which only support html files (and no PHP).

In addition to what Jannis said about some servers not having (some charge more) PHP.

There would be additional overhead involved with using PHP extension when there’s no PHP needed. Although if you have a good hosting plan at a good hosting company it should be minimal.

In the past I’ve run “stress tests” on large scale very “tuned” private servers and the difference was nearly unmeasurable. Your results on a shared hosting plan might vary.

Here’s a simplified version of what would cause the performance impact

  1. A tidy link page request comes to the server
  2. The server has a directive (Directoryindex) to determine of what to do with an incomplete path name like tidy links produce.
  3. Most servers have the default set to DirectoryIndex index.html index.cgi index.php So the server will then attempt to read each of the files in left to right order until it hits one. (Notice that’s 3 Read attempts before the PHP file is found).
  4. The server now knows it’s a PHP request so it sends the request to a PHP module to interpret the index.php file for PHP instructions even though there aren’t any the PHP modules have to check. This should be very fast but still will be additional overhead.
  5. The html page with the index.php name is severed.

Now on a “well tuned” server environment the additional overhead would be negligible, but most shared hosts are overloaded at times so any additional overhead can really slow down requests.

If you are going to default to PHP I would recommend that you change the order that the server “looks” for the files. On Apache add this to your htaccess file:

DirectoryIndex index.php index.html index.cgi

Hi Doug,

Excellent work…a very thorough and helpful answer.

I’ll probably stick with html and let RW change any pages to php that it needs to…and continue to ensure that “tidy website links” is ticked.

Cheers Scott

AND,@scottjf, you’ll have to check that you don’t have html/php pairs!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.