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.
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 https://domain.com/folder/
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.
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.
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
A tidy link page request comes to the server
The server has a directive (Directoryindex) to determine of what to do with an incomplete path name like tidy links produce.
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).
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.
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: