I have researched this to death including on this page. My index page is outside my html folder and when I hit the nav link it will not take me back home(index page). I have seen a few post on here regarding this situation, see below:
There are also two special directory names: . and ..:
. means "current directory"
.. means "parent directory"
but I have tried several see below for examples that I have tried. The index page is on/in the root directory (folder), all the other nav links work as they are in the html folder and they are up one level.
I have tried:
Index
Index
Index
Index
Out of desperation I have tried several things I knew would not work, I would really appreciate your assistance in this matter.
littleone
In my opinion the safest way is using
index
This will move the user to the root directory no matter in which directory the user currently is.
It's quite short which can be helpful too. In most cases you can omit index.html because the server uses this file automatically if you visit a directory.
I'm no web server specialist, but I'm sure you're saving your index.html in the incorrect location.
Your /html folder is your ROOT folder, anything outside of it isn't accessible via a URL. I'm sure there are ways to override that, but I have never seen anyone do this even in the most complex projects I've worked in.
For example, your site www.yoursite.com is located in the /html of your server. So if you have your index.html file outside of that folder, that file can't be accessed or served at all.
The common sense solution is to move your index.html file to the /html folder. When you do this you can then use a slash in your href, like so:
Index
Related
I have seen a lot of people been using that file name for their HTML files. I wonder why? I'm kind of new to HTML, I haven't learned much, but when I name my HTML files, I name them whatever I want. When I have been searching up examples of HTML, I have found they name it index.html. Why?
I have seen a lot of people been using that file name for their HTML files
You would typically use that name for one of your page, and it would usually be the home page.
When you arrive a website, for example www.website.com, you're not pointing to a file (like you would be if you typed www.website.com/about.html), you're pointing to a directory listing of all the files.
The webserver will try to serve a file, typically called index.html or index.php by default, but it could be something different, and it's configurable by editing your webserver's config files.
If the server doesn't find any file to serve (because you didn't include an index.html file or because you renamed it without editing the server's config) you will see a listing of the files, which is rarely the desired behavior, especially at the root of a website.
Generally the contents of index.html will be returned when just the directory is requested.
e.g. http://example.com/index.html is returned for a request for http://example.com
This is merely convention and is usually configurable.
Here is my take: It was likely named 'index' in the original internet because it is the 'indexing page' that directs to the sub pages, and you would go back to the index page to go to another page. This was before images and search engines. Later it got more advanced with a menu on all pages. This is how I remember it, but it's a long time ago.
https://twitter.com/PresidentUSW1/status/1442236777293496325?s=20
The default landing page of many Web servers defaults to index.html or default.htm and either way it's simply a start page. It's not necessary at all.
I am currently making a website, and have a folder containing CSS3 and HTML5 code in it. When I click on the index.html file, it opens up a local file and I can see my design and text in it. However, I am not sure how to have my website "point" to the index.html file, so it shows the content that is in the file. (I bought the domain with GoDaddy).
Thanks for the help!
Make Sure the directory does not have any other default files like default.php,default,html,etc and also there should be only one index file. if there is any index.php it will overtake index.html. Please make your question more clear and tell use which hosting are you using.....
Check documentation of the company that provides you hosting - the server has a list of files it looks for on disk in a given order. Only thing you need to do is to rename you file to match server's "lookup table".
Relevant part of configuration of the most popular web servers:
apache: https://httpd.apache.org/docs/current/mod/mod_dir.html
nginx: http://nginx.org/en/docs/http/ngx_http_index_module.html
I have a index.html on my root folder of a subdomain
i.e. example.example.com/index.html
and then I made a second folder (which is located in the root folder)
example.example.com/folder/index.html
Is this good/recommended?
PS I'm pretty new to this so I have a follow up question. Does this have tie in to sitemaps in a big way and do people usually use an app to do the their "sitemapping" for them?
That's fine, but there should only be 1 per folder. The index.html is the file your webserver will serve up if another is not specified, so it is normal to have one in each directory.
As far as creating the sitemap, there are a lot of tools online that will create an XML sitemap for you and that is what people usually use.
Its ok to have multiple index.html files, may be some experts will say its not a recommended way. But in my point of view as long as you know that what's going on you can have tons of index.html .
In some websites, I see links that look like this:
Link
The link doesn't go to an html file, but a folder (I believe). I was wondering if this has any purpose, and how to do this. Is there a default file to open when opening a directory? Because when I try something like this, I click the link, then I see a list of files in that folder, and I have to click on the proper link.
Everywhere I look, it says you should do links like this:
Link
Should I just let it go? I'm awfully curious.
This is something that is controlled by the web server. Some will look for a file called default.htm, others will look for index.html. It's usually configurable, and sometimes the server may look for any of a number of variations of index or default.
If such a file is not found, the server will often display a directory listing of all the files found in that folder, but usually that's not a good idea for security reasons. Again, this is something that can be controlled in the settings for the server.
Allowing directory listing is VERY dangerous and ill-advised practice. You should hide real directory structure of your site by all means.
PHPDL is a Php script that lists all the files in a directory (except itself of course). What sets PHPDL apart is that everything the script needs is in one file, including the file-type icons it uses.
Note: You can rename the script to anything you want. It will not list itself as a file to download.
This script safe and usefull, see demos:
http://greg-j.com/projects/phpdl/PHPDL-v2.php
http://greg-j.com/projects/phpdl/PHPDL-lite.php
Ok.. total noob question.
I always thought that when I saw a URL like www.siteName.com/designs/ .. that PHP or some CMS was at work. I know how filepaths work, etc. , but I always thought that generally simple sites were in a "flat" system
index.html
about.html
gallery.html
/css/
/js/
/images/
So today I just had one of those aha moments. And I now have my main directory with index.html, but a few folders (students/ , shows/, etc) In each of these I have an index.html page. This should essentially be the same as having students.html, shows.html in my main directory, correct? Except it would give me the kind of URL format I would like to have, yes? (eg mysite.com/students)
Problem is, my browser just shows me the directory. I see a file list with my index.html there, but the page is not loading automatically.
What stupid thing am I doing wrong? (I'm on localhost if that makes a difference). I thought that if your browser enters a directory it should load index.html (isnt that why people put blank index pages in a directory? To stop the contents from being listed?)
You have to configure your web server to do this. If you're running apache, it's done with a line in .htaccess like this:
DirectoryIndex index.php index.html home.html something-else.php
Those filenames are listed in order of priority, so if you have both index.php and home.html in the same folder, index.php is loaded. Usually this is set up by default, but servers can be configured a lot of ways.
If you use XAMPP on localhost, it will display the list of files instead of the index files. You can change it though, look at :
http://www.astahost.com/info/tiflds-setting-default-xampp-web-server.html
If you use something else then XAMPP there probably will be an settings somewhere to set the default file to load as well. Just Google it :)