Archana Nagarkar | 10 min read | June 30, 2020
Serve resources from a consistent URL
Are you checking your site speed in Gt metrix or any speed test tool and its showing the recommendations
“Serve resources from a consistent URL”
“Serve resources from a consistent URL”
Yes, this is a common recommendation for speed optimization. You can improve your site score if you could take care of this thing. You might be thinking, How can I do this?
NO Worries!! We are here to help you on this.
In this blog, you can get the idea about how you can be aware about what it means to “Serve resources from a consistent URL” and how you can avoid this problem on your shopify site.
Let’s see the blog in detail.
2. Serve resources from a consistent URL: Why does this suggestion occur in GTMetrix?
You can see this recommendation of speed optimization when you checked your site speed in GT metrix.
It shown the below recommendation:
‘The following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 1 request(s) and 2.4KiB.’
GTmetrix tool will give a detailed report containing URLs where this problem has occurred so that you can quickly pick up the url’s and fix it out.
So what does it mean ‘Serve resources from a consistent URL’? The term is very simple to understand.
As you know, there are many resources used on the websites, such as images, JS, CSS files and it’s useful to deliver the layout or functionality as per user desire.
Whenever a user accesses the web page, these resources get called by the browser. If there are too many identical resources then unnecessary server requests are generated and it slows down your website.
“Serve resources from a consistent url” this recommendation of gtmetrix occurs when there is identical resources calling from multiple URLs, resources are like images, JS, Css, etc. It means, instead of calling the same resources using multiple urls or different paths you can use the single url for identical resources and avoid duplication of urls for the same resources. Using that you can minimize the site requests as there was generating more requests because the same resource is calling with multiple urls.
For example, you are using the same image on your site but during uploading to the site you used different image paths.
When you check your site in GTmetrix then following recommendation will be shown:
The following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 1 request(s) and 2.4KiB.
In the above example, the same image is available inside two different paths, and on a website when browser loading this image, getting two different paths for the same resources and due to this number of requests getting increased and load time of the site will be more. So it’s necessary to serve identical resources from a consistent URL so that you can save 1 request.
In such cases, resources get duplicated. Because the same resource is available at two different URLs, every time the page is accessed by a user, an additional HTTP request is required in order to call the resource.
3. What is a consistent URL?
When you are planning to use the same images, js, css files several times on your website then to call all these files use the same URL instead of multiple URLs it’s called a consistent url. If you use consistent url for similar resources then server requests will be reduced and helps to improve the site speed.
4. How to fix serve resources from a consistent URL?
As we discussed above, this warning occurs in GTmetrix recommendation when you call identical resources like images, js or css files with different URLs.
You can fix this easily, if you see different URLs for the same resources (images, js, css) then delete one of the urls immediately. It will automatically help to reduce requests and improve site speed as requests are generated due to file duplication and will minimize after deletion of the same url which was used for several times.
If you are using the same resources in multiple subdomains or linked sites then inconsistent URLS will create there.
For example, your main website example.com, subsite is sub.example.com shares an image with subsite then this will create two paths for the same resources. To fix the issue, serve the resource from a single hostname, rather than facilitating it from a similar site and its region. That is, there is a need to have it on. To outline, example.com connection to it from sub.example.com
For Further Details or Additional Information
If you want to know more about our
Jun 30th, 2020|