dongyi1111
2014-02-27 14:08 阅读 35

上传网站文件,index.html或home.html

just about to upload my first site and have just been doing some research into how to do this whilst I await my package to be upgraded to include mysql databases.

Quick question - do I need to name my homepage 'index.html'?, and therefore change every 'home.html' link on every page of my site to 'index.html'? I've also heard 'index.htm', what is the difference between html and htm?

From what I have read, this is good practice (well, even better practice would have been to call it that from the start!) but also that you can change the default page in the htaccess file. Is this correct, and if so, is there a downside?

I am not relishing the task of changing every homepage link, but if it is considered a better option, I will.

Thanks

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • 已采纳
    douren9077 douren9077 2014-02-27 14:12

    Yes you can change the default index file and even the ordering. Some options are:

    a) You are using server side scripting - php for example Add this into a .htaccess file

    DirectoryIndex index.php index.html
    

    b) You are not using any server side scrpting

    DirectoryIndex index.html
    

    This way you do not have to deal with default values such as home.htm or index.htm

    点赞 评论 复制链接分享
  • dongzi5062 dongzi5062 2014-02-27 14:12

    It's preferred to make it as index.html as index.html is a better practise than home.html.

    Yes, you can change the index file via .htaccess and .html and .htm has no difference, it's just different extensions for the same HTML.

    点赞 评论 复制链接分享
  • dtbc37573 dtbc37573 2014-02-27 14:12

    Browser will automatically open the "index" file. Though its true - you can redirect the browser to your home.html but it is always a better option to name your start-site index.html

    about the difference between HTML and HTM... There is none.

    Years ago, in DOS times, extensions were only 3 characters long 'htm'. Now, we got longer extensions, like 'html' with 4 characters.

    点赞 评论 复制链接分享
  • du656637962 du656637962 2014-02-27 14:22

    Yes you can have home.html, however, you will have to set your default site preferences in your web server to serve that instead of the default "index.html".

    Whilst there is no difference it would be beneficial to have index.html, as it is the default and it will help you reduce web server config time if you are using clean-urls e.g. domain.com/contactus, domain.com/aboutus, etc instead of domain.com/contactus/home.html and domain.com/aboutus/home.html, etc.

    Lastly, there is no difference between .html and .htm it is just a preference thing.

    点赞 评论 复制链接分享

相关推荐