Should I name my website pages with the .php extension, even if there is no PHP in the code?
# January 5, 2013 at 6:57 pm
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 later on 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 cant 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?# January 5, 2013 at 7:12 pm
This reply has been reported for inappropriate content.
Your file extensions don’t have to have anything to do with your URLs. As long as a URL that used to link somewhere still ends up linking somewhere, you’ll be fine.
I personally don’t like mixing things up. I like everything to have a pattern and be logical. If some files have php and others don’t, why is this the case? If they will in future, I would probably use the php extension just so the code doesn’t end up being served unprocessed when I inevitably forget to change it.
If you currently have an html only site, just use html. If you change later, just use .htaccess to change the extension or do a 301 redirect. As I said above – just make sure old links work, or go somewhere useful to the user.
You must be logged in to reply to this topic.