Every site has links that point to other pages, documents, images, and even other sites. While most people understand the concept of a link, they get confused about what type of link to use under which circumstance. Linking is done by using a server path. Think of the path like a map, a set of directions that tells the computer where to find that information. How the computer determines the location of the destination file is determined by the type of path.
Relative paths, also called relative links, are shorter and tell the computer to begin where it is. The computer will begin looking in the folder the parent file (thats the page it is on) is in. In the example below, the image.png file is expected to be in the same folder as the file that is calling it.
Relative linking is very useful when used within the site itself. Most Content Management Systems (CMSes) are designed to use relative links. This is so if the site is ever renamed, all the internal links for pages and images will not break.
It is extremely important to use relative paths if you plan on securing all or part of your site with SSL. The site will need to deal with both the regular (http://) as well as the secure (https://) protocols. Absolute paths will not allow this to happen and it can break the SSL security indicator on the site.
Absolute linking or paths are very straightforward. All external linking (links to other sites) need to use absolute paths. This type of linking assumes nothing and gives the very specific location of the file as if it was always external. For example, if your site is example.com and you want to link to the image.png file in the images folder, then it will appear as in the example below.
As you can see, using the proper linking type is important. Using the wrong type of linking can have adverse effects on your site when you change something up such as using SSL or renaming the site. Knowing the difference can save you a lot of troubleshooting or downtime with your site.
n/a Points
|
2015-12-30 8:21 am
Is there a way to make all URLs load http://hostname.com without changing the URL displayed in the client's browser address bar? (hoping there is an easy way to tell the server to ignore the path and always load root - without redirecting to root because I don't want to lose the path information)Currently I'm routing using hashtag #stuff/in/single/page/app and looking for a way to remove the # then manage window.location.pathname myself.Please help I'm not sure what else to search. |
Staff 17,314 Points
|
2015-12-30 6:02 pm
Hello Dave,
Thanks for the question about changing the URL that appears in address bar. Any time that you need to do that kind of thing, you will need to become familiar with the .htaccess file and URL rewrites. Rewriting the URL is primarily used to make the path easier for a human to read and remember. It's not good practice to give ONE url for multiple locations on your website. Especially for search engine rankings since they base searches on the url of your website. You can find a good tutorial to understand URL rewriting here. I hope this helps to answer your question, please let us know if you require any further assistance. Regards, Arnel C. |
Email: | support@WebHostingHub.com | Ticket: | Submit a Support Ticket |
---|---|---|---|
Call: |
877-595-4HUB (4482) 757-416-6627 (Intl.) |
Chat: | Click To Chat Now |
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!