Re: some adjustment suggestions for the blog garden URL, the second-level domain name is not conducive to the client browser cache

Source: Internet
Author: User

The second-level domain name mechanism is not conducive to the search engine's
I have heard a sigh. So far, my blog has only been indexed on the homepage by Google,ArticleI did not accept one. Of course, the article was not accepted.
The reason for the record is mainly because I have a short period of time (only one week) in the blog garden, and there are not many articles.

Next I will talk about the cache policy of IE browser in the case of second-level domain names.
1. For website optimization, Cache Optimization is the most important part. For some commonly used. static files and
Data (mainly JS, CSS, JPG, GIF, and static html) should be cached once,
When you access the server again next time, you can retrieve it from the client cache instead of reading it from the server over the Internet.

Fortunately:
Browsers are very smart. They automatically cache static images, JS files, and CSS files.
ProgramMembers are smarter. They will tell the browser that they are prohibited from caching those dynamic data files, such as test. asp? Action = Update & id = 1.

Unfortunately:
1. When the browser caches resources, It accesses the resources according to absolute paths such as (http.
So for the following file: headerbg.jpg
If you access my blog via http://www.cnblogs.com/ashun/, the browser will cache the following address:
Http://www.cnblogs.com/Skins/KJC/Images/HeaderBg.jpg
But if you visit my blog via http://ashun.cnblogs.com,
The browser has no idea that the cache contains the headerbg.jpg file.
Or re-read the file from the server over the Internet and cache the following address:
Http://ashun.cnblogs.com/Skins/KJC/Images/HeaderBg.jpg

In the browser's eyes, www.cnblogs.com/ashun and ashun.cnblogs.com are two different websites, and the files are considered to be different files.
Files in the cache are accessed through absolute channels.

Let's analyze the real data.
I visited http://ashun.cnblogs.com/http://www.cnblogs.com/ashun/ http://www.cnblogs.com/cathsfz/ in turn

Line Started Starteddatetime Size Result URL
1 00:00:00. 000 2006-dec-04 06:48:04. 532 54524 200 Http://ashun.cnblogs.com/
2 00:00:01. 444 2006-dec-04 06:48:05. 976 7539 200 Http://ashun.cnblogs.com/Skins/KJC/style.css
3 00:00:02. 065 2006-dec-04 06:48:06. 597 824 200 Http://www.cnblogs.com/ashun/customcss.aspx
4 00:00:02. 457 2006-dec-04 06:48:06. 989 18479 200 Http://ashun.cnblogs.com/Skins/KJC/Images/HeaderBg.jpg
5 00:00:02. 466 2006-dec-04 06:48:06. 998 653 200 Http://images.cnblogs.com/xml.gif
6 00:00:02. 521 2006-dec-04 06:48:07. 053 396 200 Http://ashun.cnblogs.com/Skins/KJC/images/SubHeaderBg.gif
7 00:00:02. 605 2006-dec-04 06:48:07. 137 1097 200 Http://ashun.cnblogs.com/Skins/KJC/Images/icon-group.jpg
8 00:00:02. 648 2006-dec-04 06:48:07. 180 4004 200 Http://images.cnblogs.com/cnblogs_com/ashun/77221/t_lishun.JPG
9 00:00:02. 695 2006-dec-04 06:48:07. 227 0 (Cache) Http://ashun.cnblogs.com/
10 00:00:02. 928 2006-dec-04 06:48:07. 460 378 200 Http://ashun.cnblogs.com/Skins/KJC/Images/xmlsmall.gif
11 00:00:03. 025 2006-dec-04 06:48:07. 557 653 200 Http://ashun.cnblogs.com/images/xml.gif
12 00:00:03. 324 2006-dec-04 06:48:07. 856 1000 200 Http://www.cnblogs.com/ashun/images/icon-titledoc.gif
13 00:00:05. 081 2006-dec-04 06:48:09. 613 2843 200 Http://ashun.cnblogs.com/script/ShowHidden.js
14 00:00:05. 629 2006-dec-04 06:48:10. 161 397 200 Http://ashun.cnblogs.com/Skins/KJC/images/ColumnHeaderBg.gif
15 00:00:25. 166 2006-dec-04 06:48:29. 698 54517 200 Http://www.cnblogs.com/ashun
16 00:00:25. 951 2006-dec-04 06:48:30. 483 7539 200 Http://www.cnblogs.com/Skins/KJC/style.css
17 00:00:26. 470 2006-dec-04 06:48:31. 002 0 (Cache) Http://www.cnblogs.com/ashun/customcss.aspx
18 00:00:26. 486 2006-dec-04 06:48:31. 018 18479 200 Http://www.cnblogs.com/Skins/KJC/Images/HeaderBg.jpg
19 00:00:26. 553 2006-dec-04 06:48:31. 085 396 200 Http://www.cnblogs.com/Skins/KJC/images/SubHeaderBg.gif
20 00:00:26. 630 2006-dec-04 06:48:31. 162 1097 200 Http://www.cnblogs.com/Skins/KJC/Images/icon-group.jpg
21 00:00:26. 641 2006-dec-04 06:48:31. 173 1000 200 Http://www.cnblogs.com/
22 00:00:26. 676 2006-dec-04 06:48:31. 208 378 200 Http://www.cnblogs.com/Skins/KJC/Images/xmlsmall.gif
23 00:00:27. 182 2006-dec-04 06:48:31. 714 1000 200 Http://www.cnblogs.com/ashun/images/icon-titledoc.gif
24 00:00:28. 471 2006-dec-04 06:48:33. 003 2843 200 Http://www.cnblogs.com/script/ShowHidden.js
25 00:00:29. 252 2006-dec-04 06:48:33. 784 397 200 Http://www.cnblogs.com/Skins/KJC/images/ColumnHeaderBg.gif
26 00:00:42. 287 2006-dec-04 06:48:46. 819 58979 200 Http://www.cnblogs.com/cathsfz/
27 00:00:42. 910 2006-dec-04 06:48:47. 442 0 (Cache) Http://www.cnblogs.com/Skins/KJC/style.css
28 00:00:43. 099 2006-dec-04 06:48:47. 631 509 200 Http://www.cnblogs.com/cathsfz/customcss.aspx
29 00:00:43. 350 2006-dec-04 06:48:47. 882 0 (Cache) Http://www.cnblogs.com/Skins/KJC/Images/HeaderBg.jpg
30 00:00:43. 667 2006-dec-04 06:48:48. 199 3238 200 Http://www.copyblogger.com/wp-content/themes/copyblogger_20/images/rss.gif
31 00:00:43. 988 2006-dec-04 06:48:48. 520 1198 200 Http://www.cnblogs.com/Skins/KJC/images/icon-titledoc.gif
32 00:00:46. 854 2006-dec-04 06:48:51. 386 0 (Cache) Http://www.cnblogs.com/script/ShowHidden.js

 
Note:
Size is the file size. If it is 0, it indicates the read cache.
If the result is 200, it indicates that the server is read, or (cache) or 304 indicates that the cache is read.

We can see that access to different second-level domain names, almost all images and JS are re-requested, even though they are the same file.

If there are so many blogs in the blog Park, you only need to read these resources once if you visit the blogs of everyone.
Client browsing speed is very helpful.

Solution:
Use a uniform absolute address to access resources.

Example:
CSS file:
Background-image: URL (skins/KJC/images/test.gif)
==>
Background-image: URL (http://www.cnblogs.com/skins/kjc/images/test.gif)

HTML file:
<SCRIPT src = "test. js"> </SCRIPT>
<Link id = "maincss" type = "text/CSS" rel = "stylesheet" href = "/skins/KJC/style.css"/>
==>
<SCRIPT src = "http://www.cnblogs.com/test.js"> </SCRIPT>
<Link id = "maincss" type = "text/CSS" rel = "stylesheet" href = "http://www.cnblogs.com/Skins/KJC/style.css"/>

JS file:
VaR IMG = new image ()
IMG. src = "go_rush.gif"

==>
VaR IMG = new image ()
IMG. src = "http://www.cnblogs.com/go_rush.gif"

Next program preview:
How does one disable the browser and delete the client cache? For dynamic pages, ASP and PHP users may all know that cache is controlled through http-header.
For static files (gif.jpg, CSS, JS), how can this problem be solved ?... Please pay attention to the upcoming highlights

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.