While uploading a website I made to a domain, I realized that simply putting in the address without any specific paths, the site didn't work. For example, typing in "example.com" leads to the path directory instead of the homepage which would be under something like "example.com/home". How can I set it so that when typing in "example.com" it leads to "example.com/home"? Thanks.
Hi,
Just make a file name .htaccess and put in it this code
DirectoryIndex homepage.html
Take care you can't make .htaccess file from windows explored
Because it unnamed try to write in notepad and save without name just extension
Finally put it in website root (in hompage.html folder).
Related
Sorry if this isn't the appropriate place to ask this question, as it doesn't pertain directly to code, but I haven't found any help anywhere else.
So I've created a temporary landing page for my website that's just an .html file. I've uploaded it onto the host's public_html directory. In order to access that page I need to go to example.com/test.html. However, I'd like to be able to access that page by just going to example.com.
You can do this by adding this content to .htaccess file in public_html directory
RewriteEngine On
DirectoryIndex test.html
replace test.html with your file name
it's entry page, for whole entry pages, you should use naming index.html, rename your page to index.html
I am having a simple but frustrating problem. I have a logo on my website that I want to link back to the website's homepage. If i do href="index.html" it works but I when I try to do href="/", which I believe should also work, it takes me to the literal root directory of my computer.
For example, if I have href="/" and then I click on my logo, it directs me here:
Will this be alleviated as soon as it's hosted on a server? Any insight into this behavior would be greatly appreciated.
You're correct, an href of "/" is the root of where the file is being served from, in this case your local file system.
However, I do believe that setting an href of "index.html" or "/index.html" would be slightly more optimized performance, as "/" just resolves to "index.html" anyways.
I would also suggest you set up your local environment to have a local server, where the files are served not just read by your browser. MAMP is an easy way to do this.
Yes, this is a problem that will only occur if you're viewing a site off your filesystem rather than a local or remote server.
If you'd like to prevent this anyway, you could use relative paths rather than absolute. For example:
If you're on /photos/index.html and would like your header logo to go to /, your link could be: ../ to go up one directory.
If you're on /index.html and would like your header logo to point to the current directory, your link could be: ./ to stay in the current folder level.
You can also add this option to disable directory listing and display contents of index.html
Create a .htaccess file with the following:
Options -Indexes
Or you can have this option in the <VirtualHost> directive.
What you wanted to do can be done by :
This will clear the differnce
Further Refrence
https://www.w3schools.com/tags/att_a_href.asp
https://html.com/attributes/a-href/#Different_URL_Forms
This problem was already answered
Base URL - How to call the home link
I've been trying to resolve this issue with my website (www.wintonbrownmusic.online). I've attached a picture of how my site looks locally. When I upload it through GoDaddy, the site looks differently. I understand that others have had this issue but not sure where/how to change the CSS file to link to my website so it'll look the way that it should. Can someone assist?
I'm not sure what your hosting / creating it with, but I had a quick look at your site and found one issue.
Your HTML file is looking for the bootstrap.css file in the assets/css folder, but it appears to be in the root folder.
unless your hosting with something that is supposed to find it there.
not sure.
but when is use http://www.wintonbrownmusic.online/assets/css/bootstrap.css is doesn't work, but if I use http://www.wintonbrownmusic.online/bootstrap.css it does work.
hope that helps.
You have problems with path, If you open the console in inspect element it will show you that you have problems in calling the required files css, js, and other files.
You need to upload folders properly in the host, you need to add folders like you have in local folders in your computers. "assets" folder is missing and you just upload files inside there.
change your folder name as either assets or css ....
assets/css is a folder name because of the slash (/) browser looking for css folder inside assets folder...just give the folder
name correctly try to avoid usage of special character ,punctutation
in folder name
I am new to coding and I have just signed up to ipage hosting. I have uploaded my .html files to a root directory named "Website". I have several pages that need to be linked to the index.html home page. I have written the following code for each file: Blank but this does not seem to be working. I have also tried
<li>Blank</li>
which also does not work. When I click on a link from the index.html page this message appears.
Page Not Found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. Please try the following:
If you typed the page address in the Address bar, make sure that it is spelled correctly.
Click the Back button in your browser to try another link.
Use a search engine like Google to look for information on the Internet.
I have tried everything!! Please help!!
In some cases not only directory name is case sensitive, but might be that Website directory is your website's root directory. Therefore I would put these links to index.html and test which works:
<li>Blank</li>
<li>Blank</li>
<li>Blank</li>
It sounds like your files are all in the same folder. In that case you can just do the following:
<li>Blank</li>
Since it is in the same directory /Website/ is not needed and will break your code.
You might want to consider removing the 1st slash..
Try making your link
Blank
Also remember that directory names and files names are case sensitive
When I code my website, on my local computer i can use
blablabla.
However, I also can see this type of thing on other places as
blablabla.
I am not sure what I will need when my site goes live. If I try to do this on my local computer, it doesn't understand it. My question is, if I post my site up like this, will it work?
Ok, if I have all of the files of my site in the root directory that the main index.html file is located in, will it work when it is being hosted?
If you do not use a slash, the link will point to index.html in the same folder as the page the link is on.
For example, if you have a link to index.html on the page www.example.com/page2.html then the link will take you to www.example.com/index.html. If you include a slash, it will do the same thing.
However, if the link is in a page in a subfolder, like www.example.com/projects/page2.html, then the first link will take you to www.example.com/projects/index.html while the second link will still take you to www.example.com/index.html.
The slash denotes the "web root."
Note that these are still considered "relative" links: they refer to a resource on the same server, regardless of the server's name. If your domain name changes or you upload it to another server, relative links will still work provided they have the same folder structure.