• # 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:11 pm

    That’s what 301 redirects are for.

    # 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.

    # January 5, 2013 at 7:23 pm

    Thats awesome… Thanks Ben!

    # January 5, 2013 at 7:37 pm

    You could also configure your server to parse html files as php. For most hosts this can be done easily by adding 1 line in the .htaccess file.

    # January 5, 2013 at 10:35 pm

    Naming your html files ‘php’ is truly haggard. It serves absolutely no purpose.

    # January 6, 2013 at 2:31 am

    > Naming your html files ‘php’ is truly haggard. It serves absolutely no purpose.

    …and at the same time, it wastes server resources passing a file (that contains no php code) through the php interpreter, instead of simply serving it as HTML.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.