This is likely a very simple question, but I’m having trouble understanding the verbiage in the docs.netlify documentation.
I have two sites:
My main portfolio site
A restaurant site
I created a link in site 2 that points to site 1, but I get a 404 error. The other external link I created worked great, but linking to another netlify site on the same team creates a problem.
This link works:
This link doesn’t work:
The documentation mentioned redirects, but I’d rather load the nperdomo.netlify.app site by itself. Is this possible with the .netlify.app site? Do I need to purchase a domain to be able to link externally?
If so, can someone walk me through the process or point me to a resource that will help me create a _redirects file?
I tried to provide as much information as possible. Let me know if there’s anything that needs clarity!
Are you talking specifically about the link at the bottom of the page (underlined below)?
href value is
nperdomo.netlify.app. To link to external sites you need to use
http://) at the beginning e.g.
https://nperdomo.netlify.app otherwise browsers will think the resource is part of the site currently viewed (e.g. another HTML file.)
There is no need for a
Like I said, simple solution, but I couldn’t figure it out for the life of me. Thanks again for the tip:
always include https:// when linking to another site.
here is a little more information on some different kinds of links:
a link WITH the
http:// is called an “absolute link” while a link without the http (so, a link that references something internal to the site the document that doing the linking is on is called a “relative link”.
the thing that is different between the links is called a path:
http://www.somecoolsite.com/some/directory/index.html is a path, in this case an absolute one
these are all relative: (relative to where you are currently/what you are currently looking at)
/going/in/to/these/directories/and/loading/a/file.html is a very long path to a file in some nested directories
../../../../../index.html is a path
and so is
all are basically instructions on where to go and what to load.
you can consider absolute paths a bit like “drive to this completely new city, then to this address, then to this room in this building and talk to so-and-so”
wheras relative paths are: “stay in the same building you are currently in, go to the lobby, take the elevator up to the 5th floor, then find room 505 and talk to the person there”
both ultimately do the same thing but make different assumptions
Thanks for the in-depth explanation and the resource. Checking it out now.
Based on your response, it seems like I don’t need to include anything before the “/” when writing links within the same site. If I’m linking to another page on my website, HTTP://www.somecoolsite.com/, I can just include the relative path, which would be everything after the last “/”.
I just read the article you linked to, and it looks like I can use “…” in the same way I’d use it in Terminal to navigate to a higher directory. Great tip. Thanks again!