#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    24
    Rep Power
    0

    Default index file question


    Hi all,

    normally, I use index.html as my main entry file so that www.domain.com will open that file.

    My current project uses .shtml file as the main file. I just checked and my browser opened that file fine too, but I'm not sure if that's standard or even supported by all/most browsers.

    Do I need a redirect from index.html to index.shtml?

    Thanks,
    Stefan
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    this has absolutely nothing to do with browsers. The webserver is responsible for serving the right content for a particular request.

    In common webservers, you can specify a list of index files like index.html or index.php. And in your case, this list obviously includes index.shtml.

    If you want concrete advice, we need to know the webserver you're using.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    24
    Rep Power
    0
    Originally Posted by Jacques1
    If you want concrete advice, we need to know the webserver you're using.
    Hi Jacques,

    I have no idea what server I'm using. I don't even know how to find out.

    It's handled by these guys:
    http://www.1und1.de/

    Does that help?

    Thanks,
    Stefan
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,128
    Rep Power
    4304
    Ok, you're using 1&1. Do you have a Linux or Windows hosting package? If Linux, then it's Apache; if Windows, then it's IIS. (Apache can be used on Windows, but, as far as I can tell, 1&1 only uses it on Linux.)
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    24
    Rep Power
    0
    Originally Posted by Kravvitz
    Ok, you're using 1&1. Do you have a Linux or Windows hosting package? If Linux, then it's Apache; if Windows, then it's IIS. (Apache can be used on Windows, but, as far as I can tell, 1&1 only uses it on Linux.)
    Linux/Apache, I believe.

    Stefan
  10. #6
  11. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,128
    Rep Power
    4304
    That is controlled with the DirectoryIndex directive: http://davidwalsh.name/directory-ind...epage-htaccess

    If it's already working for you though, you don't need to set it yourself.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    24
    Rep Power
    0
    Originally Posted by Kravvitz
    If it's already working for you though, you don't need to set it yourself.
    Great, thanks!

    Stefan
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    4
    Rep Power
    0

    re: redirect


    Originally Posted by stefangs
    Hi all,

    normally, I use index.html as my main entry file so that (link address blocked: See forum rules) will open that file.

    My current project uses .shtml file as the main file. I just checked and my browser opened that file fine too, but I'm not sure if that's standard or even supported by all/most browsers.

    Do I need a redirect from index.html to index.shtml?

    Thanks,
    Stefan
    i don't think you need to redirect,because "index" is the keyword which is executed as main file, extension dosen't matter. e.g index.php,index.shtml, index.html. Based on the index keyword it will get executed and based on the extension browser will recognize the type of application and render it accordingly.

    Comments on this post

    • Jacques1 disagrees : This is just plain wrong (at least for common webservers like nginx and Apache). No idea where you got it from.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    24
    Rep Power
    0
    Originally Posted by JohnFernandes
    i don't think you need to redirect,because "index" is the keyword which is executed as main file, extension dosen't matter. e.g index.php,index.shtml, index.html. Based on the index keyword it will get executed and based on the extension browser will recognize the type of application and render it accordingly.
    Yes, that's what I understand now. Just needed some reassurance. I'll go with that.

    Thanks,
    Stefan
  18. #10
  19. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,128
    Rep Power
    4304
    Originally Posted by JohnFernandes
    [...] "index" is the keyword which is executed as main file, extension dosen't matter. e.g index.php,index.shtml, index.html. Based on the index keyword it will get executed and based on the extension browser will recognize the type of application and render it accordingly.
    I take it you didn't take the time to read what Jacques1 and I said.

    The extension does matter. There is nothing special about files named "index" -- it's just the convention. The server defaults to include certain file names. For example, by default, IIS uses "Default.htm", "Default.asp", and "iisstart.htm" in addition to "index.htm" and "index.html".
    Last edited by Kravvitz; September 4th, 2013 at 06:32 PM.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo