{"id":795,"date":"2021-01-26T10:57:14","date_gmt":"2021-01-26T10:57:14","guid":{"rendered":"http:\/\/blog.webhosting.uk.com\/2007\/01\/20\/types-of-url-absolute-and-relative\/"},"modified":"2024-07-03T10:59:13","modified_gmt":"2024-07-03T10:59:13","slug":"types-of-url-absolute-and-relative","status":"publish","type":"post","link":"https:\/\/www.webhosting.uk.com\/blog\/types-of-url-absolute-and-relative\/","title":{"rendered":"Types of URLs (Absolute and Relative) and Their Differences"},"content":{"rendered":"\r\n<p class=\"wp-block-paragraph\">Uniform Resource Locators (URLs) are essential elements of all websites. As the name suggests, they allow search engines and users to locate and access the resources you have made available online. Essentially, they are the web addresses of your web pages, images, videos and any other resource you have published to your website.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">The way a URL is structured plays an important role in enabling your website to be properly crawled and indexed by search engines. Without the right structure, parts of your website might not be findable by search engines and would, therefore, be unavailable to your visitors.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">There are two types of URL that you can have on a website: Absolute URLs and Relative URLs.<\/p>\r\n<p>In this post, we\u2019ll look at these two versions, showing the difference between them and explaining what use each is suited for.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\"><strong>Absolute\u00a0URLs<\/strong><\/h2>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">An absolute URL contains the entire address of the resource which it points to and usually has the following structure:<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>protocol:\/\/domain\/path<\/strong><\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>The protocol is usually <em>http:\/\/<\/em> or <em>https:\/\/<\/em> (though it could also be <em>ftp:\/\/<\/em> or <em>file:\/\/<\/em>.<\/li>\r\n\r\n\r\n\r\n<li>The domain is the name of your website, e.g. <em>yourbusiness.com<\/em><\/li>\r\n\r\n\r\n\r\n<li>The path is the pathway of the directory and sub-directories to where the file is located and the name and extension of the file. e.g. <em>wordpress\/wp-contents\/includes\/file1.html<\/em><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">The complete absolute URL, for example, would be:<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">https:\/\/yourbusiness.com\/wordpress\/wp-contents\/includes\/file1.html<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\"><strong>Relative URLs<\/strong><\/h2>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">While an absolute URL can locate a file from anywhere on the internet, a relative URL can only be used to locate a file if you are on the same website. Rather than give an absolute address, it shows where the file is in relation (hence the term \u2018relative\u2019) to where you currently are on the website. Assuming that the visitor is already within the website, a relative URL only contains the domain followed by the location, e.g.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><em>&lt;a href = &#8220;\/file1.html&#8221;&gt;<\/em><\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>Benefits of Using Relative URLs<\/strong><\/h3>\r\n\r\n\r\n\r\n<ul>\r\n<li><strong>Faster coding and development<br \/><\/strong>You can code a website far easier if you only need to use, shorter relative URLs. If you are developing a website and have live and developmental versions with different domains, relative URLs allow you to bring your newly developed site online without having to modify all the URLs to those of your live site.<\/li>\r\n<li><strong>Effective Internal linking<br \/><\/strong>Remember, relative URLs can only be used to link to resources with the same root directory.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>Benefits using absolute URLs<\/strong><\/h3>\r\n\r\n\r\n\r\n<ul>\r\n<li><strong>Makes it difficult to clone your site<br \/><\/strong>Cloned websites are used by cybercriminals to defraud a company\u2019s customers. To create clones, they use scraping tools that search and copy a site\u2019s content. Absolute URLs make it more difficult for them to do this.<\/li>\r\n<li><strong>Stops duplicate content<br \/><\/strong>Duplicate website content can impact your SEO and your site\u2019s ranking. Absolute URLs help prevent duplicate content issues. Search engines, for example, consider the http:\/\/, http:\/\/www, https:\/\/ and https:\/\/www versions of a website as different websites. If all these versions were crawled and the site used relative URLs, it could lead the search engines to index four versions of each of your web pages. As absolute URLs contain the specified protocol, this cannot happen.<\/li>\r\n<li><strong>Assists with search engine indexing<br \/><\/strong>Search engine crawlers index your site by following internal links. However, they don\u2019t always search the whole site. Using absolute URLs, however, makes it easier for them to index more of your site quickly so that more of your pages are searchable online.<br \/><br \/><em><strong>Want to rank higher on SERP ? Here are <a href=\"https:\/\/www.webhosting.uk.com\/blog\/seo-10-tips-for-a-homepage-that-ranks\/\">10 SEO Tips for a Homepage That Ranks<\/a><\/strong><\/em><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h4>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Absolute and relative URLs are both ways to structure your site and link to its resources. There are advantages and disadvantages to each. While absolute URLs provide better security and improved SEO, relative URLs are quicker and easier to use when developing websites.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">If your site needs secure, high-performance hosting, visit our homepage to see our range of <strong><a title=\"web hosting solutions\" href=\"https:\/\/www.webhosting.uk.com\/\">web hosting solutions<\/a><\/strong>.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Uniform Resource Locators (URLs) are essential elements of all websites. As the name suggests, they allow search engines and users to locate and access the resources you have made available&hellip;<\/p>\n<p><a href=\"https:\/\/www.webhosting.uk.com\/blog\/types-of-url-absolute-and-relative\/\" class=\"more-link\">Read More<\/a><\/p>\n<div class='heateorSssClear'><\/div><div  class='heateor_sss_sharing_container heateor_sss_horizontal_sharing' data-heateor-sss-href='https:\/\/www.webhosting.uk.com\/blog\/types-of-url-absolute-and-relative\/'><div class='heateor_sss_sharing_title' style=\"font-weight:bold\" >Spread the love<\/div><div class=\"heateor_sss_sharing_ul\"><a aria-label=\"Facebook\" class=\"heateor_sss_facebook\" href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.webhosting.uk.com%2Fblog%2Ftypes-of-url-absolute-and-relative%2F\" title=\"Facebook\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg\" style=\"background-color:#0765FE;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path fill=\"#fff\" d=\"M28 16c0-6.627-5.373-12-12-12S4 9.373 4 16c0 5.628 3.875 10.35 9.101 11.647v-7.98h-2.474V16H13.1v-1.58c0-4.085 1.849-5.978 5.859-5.978.76 0 2.072.15 2.608.298v3.325c-.283-.03-.775-.045-1.386-.045-1.967 0-2.728.745-2.728 2.683V16h3.92l-.673 3.667h-3.247v8.245C23.395 27.195 28 22.135 28 16Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"X\" class=\"heateor_sss_button_x\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%25%25title%25%25&url=https%3A%2F%2Fwww.webhosting.uk.com%2Fblog%2Ftypes-of-url-absolute-and-relative%2F\" title=\"X\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_x\" style=\"background-color:#2a2a2a;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg width=\"100%\" height=\"100%\" style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#fff\" d=\"M21.751 7h3.067l-6.7 7.658L26 25.078h-6.172l-4.833-6.32-5.531 6.32h-3.07l7.167-8.19L6 7h6.328l4.37 5.777L21.75 7Zm-1.076 16.242h1.7L11.404 8.74H9.58l11.094 14.503Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"Linkedin\" class=\"heateor_sss_button_linkedin\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Fwww.webhosting.uk.com%2Fblog%2Ftypes-of-url-absolute-and-relative%2F\" title=\"Linkedin\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_linkedin\" style=\"background-color:#0077b5;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path d=\"M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z\" fill=\"#fff\"><\/path><\/svg><\/span><\/a><\/div><div class=\"heateorSssClear\"><\/div><\/div><div class='heateorSssClear'><\/div>","protected":false},"author":130,"featured_media":12319,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1217],"tags":[],"ppma_author":[2389],"class_list":["post-795","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-design-development"],"authors":[{"term_id":2389,"user_id":147,"is_guest":0,"slug":"niraj-chhajed","display_name":"Niraj Chhajed","avatar_url":{"url":"https:\/\/www.webhosting.uk.com\/blog\/wp-content\/uploads\/2016\/10\/1671629317463.jpg","url2x":"https:\/\/www.webhosting.uk.com\/blog\/wp-content\/uploads\/2016\/10\/1671629317463.jpg"},"author_category":"1","user_url":"https:\/\/www.webhosting.uk.com\/","last_name":"Chhajed","first_name":"Niraj","job_title":"","description":"I'm a SEO and SMM Specialist with a passion for sharing insights on website hosting, development, and technology to help businesses thrive online."}],"_links":{"self":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts\/795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/users\/130"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/comments?post=795"}],"version-history":[{"count":11,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts\/795\/revisions"}],"predecessor-version":[{"id":19496,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts\/795\/revisions\/19496"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/media\/12319"}],"wp:attachment":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/media?parent=795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/categories?post=795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/tags?post=795"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}