I am very new to html. The following link works on a web hosting I am making:
Profile <br />
If I want to make a link on my local server would it be something link this?
Profile <br />
If you would like to make localhost link you should not use localhost, its enough to use folders & files only.
Here 2 link examples:
Link number 1 - localhost link
this link can be used not only in localhost, also in online server hosting, all you need is the file location you need and his extension (.php, .js, .html and more...)
assuming that file.html is inside folder1 and I would like to add link that will direct me in to it, i will write the next code:
File.html
lets assume the file i want to be redirected to is one folder back from my website, so I'll add ../ to return back and go to file.html.
This file is one folder before my website.
Link number 2 - unlocalhost link
A link who's not inside my website folder / hosting server will redirect me to other side, for example, stackoverflow.com website, if i would like to add link into stack overflow I will write the next line:
go to stackoverflow.com
Related
I faced a problem using a link inside my main html and giving another html file name to the link which is in the same root as the main html.
unfortunately after click on the link the address bar is changed but the page is not loaded and it redirects to the main html page.
this is the way I wrote the link:
click
this is my folder structure:
I also tried with giving the full path but I got this error:
Not allowed to load local resource: file:///C:/my_project/templates/PU.html
As you said in the comments, I assume you're working locally on your computer, so I'm going to answer accordingly.
The first and foremost thing to know is that your main, i.e the file you want users to see first should be named as index.html and it should be in the root directory of your project, i.e according to your question, it should be in my_project.
Now if it is as I said, then your my_project folder/directory will be considered as the root directory. With the help of this consideration, now you can set links with respect to the root directory. e.g:
click
The / at the beginning here tells the HTML to look from the root directory, i.e from my_project in your case.
I don't see any errors in the code you have. Though, I will tell you a few things here.
**./** at the beginning of the link tells HTML to look at the file in the same folder as of the present file. So, if the PU.html file is not in the same folder as of the file you're working on, it will give an error, because as I said, it's looking for the file in the same folder.
There is nothing wrong with your syntax.
click is correct,
but if you have your files in the same directory you don't need ./.
I have multiple sites in my hosting stored with the following folder structure:
ROOT-FOLDER - SITE1 example.com
SUB-FOLDER - SITE2 another-example.com
On the site in sub-folder I used html base tag in order to take advantage of relative links, however I faced some issues. The problem is that if I open the second site by its domain name it loads with the same name, but when I navigate any link it replaces the site's domain name with the one in root.
So, if any link clicked on the site, instead of getting following in address bar:
another-example.com/page1.php
I get this:
example.com/SITE2/page1.php
Could you please explain how to solve the issue?
P.S. the base tag look like this:
<base href="http://example.com/site2/" />
I have index.html in /var/www, which is my root document directory. I also have relevantskills.html in the same directory. The first link on index.html leads me to relevantskills.html. When I go to my website at http://brianhotopp.cf/ I can see index.html, and when I click on the first link, it displays relevantskills.html. However, when I try to access relevantskills.html from http://brianhotopp.cf/relevantskills.html, It brings me to index.html. Also I cannot view images in my root document directory. For example, I have a png called favicon, but when I go to mywebsite/favicon.png, it displays the default favicon for my domain name provider, not the one I have in /var/www. Is this a problem with my configuration? My permissions? Any help is appreciated, thanks.
Your website is running inside an iframe, that's why it is not working. When you're clicking on a link, your browser is not "redirected" but the website in the iframe is. That's also why you don't see any changes in the url bar on top of your browser.
I suppose you don't want to see your website inside an iframe. If this is the case, you better contact your hosting company because this is a dirty way of hosting websites.
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.
When creating the html files for my website, I had no problem understanding how to create links so that users could navigate between pages. For example, this worked fine to send someone to the about page:
ABOUT
I'm having issues upon uploading the html files to my web server.
How, do I get About link to send the user to: www.blahblahblah.com/about ?
My landing page has been renamed index.html.
You need to add http:// in the href to go to a page on an external site:
About page on blahblahblah.com
This is because when you simply link to it without the http:// in front (hyper text transfer protocol) it is trying to go to the page "www.blahblahblah.com" which obviously does not eixst on your server. When you add the http://, the browser knows that it is another website and therefore will bring you to the external site.
Your web server will be configured with a "document root" directory. Usually this is the directory where index.html is located. Place your about.html in the same directory, and the link you provided will link to it if it is served from the same URL-path (that is to say, it's not in a sub-folder). If your files are indeed in the document root, you may prefix your link href attributes with a forward-slash, which indicates that the path is relative to the document root.
As noted in the previous comment, this technique only works for pages hosted in the same directory as each other, on the same host. If the files are in different directories, you must start with the slash, and if they are on different hosts, you must include the full domain and path.
This is what he meant:
<input type="button" value="SampleText" onClick="window.location='http://www.blahblahblah.com/about';">
and this will open it in a new window:
<input type="button" value="SampleText" onclick="window.location='http://www.blahblahblah.com/about';" target="_blank">