Question:
Should I name my website pages with the extension .php?
?
2013-01-05 15:52:15 UTC
I was once told by a web design/development teacher that it is good practice to name your website pages with the .php file name instead of .html even if you have no PHP in your code.

The reason for this is that if you name your web pages with the .html file name and then decide to re-design your site using PHP and change your web pages file names to .php then you will lose your search engine position, break all the back-links on other sites and generally you will be starting all over again with marketing your site.

I have been trying to find more information on this to verify if the teacher was correct, even though it does make sense, but I can not find anything to confirm that yes - it is a good idea to name your files with the .php extension even though you have no PHP code.

Can anyone advise if this is correct or not?
Three answers:
Tizio 008
2013-01-05 15:58:38 UTC
maybe for consistency but the "searching engine problem" can be easily resolved creating a rewrite rule that change every .html request into a .php one, so that indexed pages will be still reacheable.



using a similar mind I would say it's better to hide completely your naming convention and make the resources accessible using URLs which do not map to actual file name on your server, e.g.



site.com/main



instead of



site.com/main.php



site.com/pages/1



instead of



site.com/pages.php?p=1



and so on.



this can be done and in fact is often done and according to someone is better
?
2013-01-05 23:55:00 UTC
What your teacher says is correct.



There are ways to redirect .html page requests to .php, so if you needed to change over a site, you could do it with server settings. But it is much easier to just name everything whatever.php
Ahmad
2013-01-06 16:16:38 UTC
I am a webdeveloper too. I usually name mile files .html if only i am 100% that there will be no server side coding. .php expension is only to execute php code. Therefore if you have no server side code, then you dont have to use .php.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...