|
Custom Search
| |
|
Absolute Path and Relative Path Explained
Web pages consist of web links. The links can send users either to external sites or to pages on the same site which is internal links. Internal links can be created by using either absolute path or relative path. Relative path is a path relative to the current page's path location. Current page is the page that contains the URL link. Absolute path is a path that starts with domain URL. Absolute path can be a full path or take the form of a short version. The short version always starts with a forward slash, which is the part of a full URL without the domain name part. Recommendation When you link to a page on your own website, always use the short version of an absolute path or use relative path. This speeds up page load time because you have told web server that the linked page is located on the same site. Another advantage of avoiding the use of full version of absolute path is that if you ever need to change domain name for your site, the links are not going to break. This is because you didn't hard code your old domain name into the links with full version of absolute path. When you link to a page on another website, you can only use full absolute path. That is a full URL. Absolute Path and Relative Path Examples
The following table shows you examples of the various paths. We assume current page location is:
When you link to a page located two directories up from the current directory, it will be like this:
That's because your current page location is http://www.site.com/products/sales/july/index.html |
Copyright © 2024 GeeksEngine.com. All Rights Reserved. This website is hosted by HostGator. No portion may be reproduced without my written permission. Software and hardware names mentioned on this site are registered trademarks of their respective companies. Should any right be infringed, it is totally unintentional. Drop me an email and I will promptly and gladly rectify it. |
Home | Feedback | Terms of Use | Privacy Policy |