ããŒãžã®èªã¿èŸŒã¿é床ãå€ãã®èŠå ã«åœ±é¿ããããšã¯èª°ã«ãšã£ãŠãç§å¯ã§ã¯ãªããšæããŸãã 誰ããç¥ããªãå Žåãç°¡åã«èšããšæ¬¡ã®ãšããã§ããããŠã³ããŒãé床ã¯ã蚪åè
ããµã€ããããŒãããããŸã§åŸ
ã€ãã©ããã ãã§ãªããSEOã®æé©åã«ã圱é¿ããŸãã å®éãä»æ¥ãå€ãã®æ€çŽ¢ãšã³ãžã³ã¯ããµã€ããã©ã³ã¯ä»ããããšãã«ãããŒãžã®èªã¿èŸŒã¿é床ãèæ
®ãå§ããŠããŸãã ãããã£ãŠããµã€ãã®èªã¿èŸŒã¿ãé«éã«ãªãã»ã©ãæ€çŽ¢ãšã³ãžã³ããããå€ãã®èšªåè
ãç²åŸã§ãããããããããããå€ãã®ãéã皌ãããšãã§ããŸãã
ãã®ããããã®èšäºã§ã¯ãWebããŒãžãšãµã€ãå
šäœã®èªã¿èŸŒã¿é床ãäžããæ¹æ³ã«é¢ããããã10ã®ãã³ããåéããããšã«ããŸããã ãã®èšäºã¯å€©æã§ãããšäž»åŒµãããã®ã§ã¯ãªããåå¿è
ã察象ãšããŠããŸãã
ããã§ã¯ãè¡ããŸãããïŒ
1. HTTPãªã¯ãšã¹ãã®æ°ãæžããããŒãžã®èªã¿èŸŒã¿ã®80ïŒ
ã¯ãããŒãžã³ã³ããŒãã³ãïŒã¹ã¯ãªãããåçãCSSãã¡ã€ã«ããã©ãã·ã¥ïŒã®èªã¿èŸŒã¿ã«éäžããŠããŸãã HTTP / 1.1ä»æ§ã§ã¯ããã©ãŠã¶ã¯åäžã®ãã¹ããã2ã€ä»¥äžã®WebããŒãžã³ã³ããŒãã³ããåæã«ããŠã³ããŒãããããšãæšå¥šããŠããŸãã ãããã®ã³ã³ããŒãã³ãã®æ°ãæžããããšã«ããããµãŒããŒãžã®HTTPãªã¯ãšã¹ãã®æ°ãæžããçµæãšããŠããŒãžã®èªã¿èŸŒã¿é床ãåäžããŸãã
ããããããŒãžã®å€èŠ³ã«åœ±é¿ãäžããã«ãµãŒããŒèŠæ±ã®æ°ãæžããæ¹æ³ã¯ãããŸããïŒ
å®éã«ã¯ããã€ãã®æ¹æ³ããããŸãã
- CSSã¹ãã©ã€ãã䜿çšããŸãã CSSã¹ãã©ã€ãã¯ãèæ¯ç»åãšèæ¯äœçœ®ã®ããããã£ã䜿çšããŠãç®çã®ããŒãžèŠçŽ ã«é©åãªã¿ã€ãã³ã°ã§åãåãããããã€ãã®å°ããªç»åãå«ãçµåç»åã§ãã
- ã€ã³ã©ã€ã³ç»åã®äœ¿çšã ã€ã³ã©ã€ã³ç»åã¯data ïŒ URLã¹ããŒã ã䜿çšããŠãããŒãžèªäœã«ç»åãåã蟌ã¿ãŸãã ãã ããããã«ãããHTMLããã¥ã¡ã³ãã®ãµã€ãºã倧ãããªããŸãã ã¹ã¿ã€ã«ã·ãŒãã«ã€ã³ã©ã€ã³ç»åãåã蟌ãããšã«ããããµãŒããŒèŠæ±ãæžãããHTMLãµã€ãºã¯åããŸãŸã«ãªããŸãã
- è€æ°ã®ãã¡ã€ã«ã1ã€ã«ããŒãžããŸãã ããŒãžã«è€æ°ã®cssãŸãã¯jsãã¡ã€ã«ãæ¥ç¶ãããŠããå Žåã¯ããããã1ã€ã«çµåã§ããŸãã ããã¯éåžžã«ã·ã³ãã«ã§ããããµãŒããŒãžã®httpãªã¯ãšã¹ãã®æ°ãæžããå¹æçãªæ¹æ³ã§ãã ãªã³ã¶ãã©ã€ã§ãããè¡ãæ¹æ³ã«ã€ããŠã¯ã ããµã€ããå éããã ãã®å Žã§ã®cssããã³jsãã¡ã€ã«ã®éçå§çž®Â»
2. CSSãã¡ã€ã«ãããŒãžã®äžéšã«é
眮ããŸãããŒãžããããŒã«cssãã¡ã€ã«ãžã®æ¥ç¶ãé
眮ããããšã«ãããããŒãžã®æ®µéçãªã¬ã³ããªã³ã°ãååŸããŸãã ããŒãžã¯åŸã
ã«èªã¿èŸŒãŸããŸã-æåã«ã¿ã€ãã«ã次ã«äžéšã®ããŽãããã²ãŒã·ã§ã³ãªã©ã -ãããŠãããã¯ããŠãŒã¶ãŒã®ããŒãžèªã¿èŸŒã¿ã®åªããææšãšããŠæ©èœãããµã€ãã®å
šäœçãªå°è±¡ãæ¹åããŸãã
CSSãã¡ã€ã«ãããŒãžã®äžéšã«é
眮ãããšãå€ãã®ãã©ãŠã¶ãŒãããŒãžãåŸã
ã«ã¬ã³ããªã³ã°ããã®ãé²ããŸãã ããã¯ããã©ãŠã¶ãããŒãžã®èªã¿èŸŒã¿åŸã«ã¹ã¿ã€ã«ãå€æŽããå¯èœæ§ã®ããèŠçŽ ãåæç»ããããªãããã§ãã ãã®ããããã¹ãŠã®CSSãã¡ã€ã«ãåžžã«ããŒãžäžéšã®HEADã»ã¯ã·ã§ã³ã«å«ããŠãã ããã
3.ããŒãžã®äžéšã«JavaScriptãé
眮ããŸãããŒãžã®äžéšã«javascriptãã¡ã€ã«ãé
眮ããããšã«ããããã©ãŠã¶ãŒã¯æåã«ã³ã³ãã³ããå«ãããŒãžãããŒããããã®åŸã«ã®ã¿JavaScriptãã¡ã€ã«ã®ããŒããéå§ããŸãã ãµã€ããåžžã«ææ°ã§ãããå¯èœãªãã¹ãŠã®ã€ã³ã¿ã©ã¯ãã£ããªãã¬ãžã§ããããå«ãã§ããå Žåããããã®javascriptãã¡ã€ã«ãããã€ãååšããå¯èœæ§ããããæ°çŸãããã€ãã«ãªãå¯èœæ§ããããããããŒãžãããŒãããåã«ããã¹ãŠã®javasciptãã¡ã€ã«ãããŒãããããŸã§ãŠãŒã¶ãŒãåŸ
ãããŸãã
ããã«ãå€éš.jsãã¡ã€ã«ã¯äžŠåèªã¿èŸŒã¿ããããã¯ããŸãã HTTP / 1.1ä»æ§ã§ã¯ããã©ãŠã¶ã¯åäžã®ãã¹ããã2ã€ä»¥äžã®WebããŒãžã³ã³ããŒãã³ããåæã«ããŠã³ããŒãããããšãæšå¥šããŠããŸãã ãããã£ãŠããµã€ãã®ã€ã¡ãŒãžãç°ãªããã¹ãã«ããå Žåã2ã€ä»¥äžã®äžŠè¡ããŠã³ããŒããååŸã§ããŸãã ãŸããã¹ã¯ãªãããèªã¿èŸŒãŸãããšããã©ãŠã¶ã¯ä»ã®ãã¹ãããã§ãä»ã®ããŠã³ããŒããéå§ããŸããã
4. CSSãšJavaScriptãæå°åãããã¡ã€ã«ã®æå°åãšã¯ããã¡ã€ã«ã®ãµã€ãºãçž®å°ããããŒããé«éåããããã«ãã³ãŒããããã¹ãŠã®éå¿
é æåãåé€ããããšã§ãã æå°åããããã¡ã€ã«ã§ã¯ããã¹ãŠã®ã³ã¡ã³ããšæå³ã®ãªãã¹ããŒã¹ãæ¹è¡ãã¿ããåé€ãããŸãã ããã§ã¯ãã¹ãŠãç°¡åã§ãã ãã¡ã€ã«ãµã€ãºãå°ããã»ã©ããã©ãŠã¶ãããŠã³ããŒãããæéãçããªããŸãã ãŸãã
CSSã³ãŒã
ãå§çž®ããã³æé©åãããããã®
24ã®ãªã³ã©ã€ã³ãµãŒãã¹ã¯ ã
ã³ãŒãã®æå°åã«åœ¹ç«ã¡ãŸã
ã5.䞊åããŠã³ããŒãã«ãµããã¡ã€ã³ã䜿çšããåè¿°ããããã«ãHTTP / 1.1ä»æ§ã«ããã°ããã©ãŠã¶ãŒã¯åæã«ããŒãããããµã€ãã³ã³ããŒãã³ãã®æ°ãã€ãŸã1ã€ã®ãã¹ããã2ã€ä»¥äžã®ã³ã³ããŒãã³ãã«å¶éã課ããŸãã ãããã£ãŠããµã€ãã«å€ãã®ã°ã©ãã£ãã¯ã¹ãããå Žåã¯ã1ã€ãŸãã¯è€æ°ã®åå¥ã®ãµããã¡ã€ã³ã«é
眮ããããšããå§ãããŸãã ããªãã«ãšã£ãŠãããã¯åããµãŒããŒã«ãªããŸããããã©ãŠã¶ã«ãšã£ãŠã¯ç°ãªããŸãã äœæãããµããã¡ã€ã³ãå€ãã»ã©ããã©ãŠã¶ãåæã«ããŠã³ããŒãã§ãããã¡ã€ã«ãå€ããªãããµã€ãã®ããŒãžå
šäœã®èªã¿èŸŒã¿ãéããªããŸãã åçã®ã¢ãã¬ã¹ãæ°ãããã®ã«å€æŽããã ãã§ãã éåžžã«ã·ã³ãã«ã ãå¹æçãªæ¹æ³ã
6.ãã©ãŠã¶ã®ãã£ãã·ã¥ã䜿çšãããã£ãã·ã³ã°ã¯ãJavaScriptãšCSSã®åºç¯ãªæ¥ç¶ã䜿çšããææ°ã®Webãµã€ãã«ãšã£ãŠéèŠã«ãªã£ãŠããŸãã å®éã«ã¯ã蚪åè
ãåããŠãµã€ãã«ã¢ã¯ã»ã¹ãããšããã©ãŠã¶ãŒã¯ãã¹ãŠã®javascriptãã¡ã€ã«ãšcssãã¡ã€ã«ãããŠã³ããŒããããã¹ãŠã®ã°ã©ãã£ãã¯ãšãã©ãã·ã¥ãããŠã³ããŒãããŸãããExpires HTTPããããŒãæ£ããèšå®ãããšãããŒãžã³ã³ããŒãã³ãããã£ãã·ã¥å¯èœã«ãªããŸãã ãããã£ãŠã蚪åè
ãåã³ãµã€ãã«ã¢ã¯ã»ã¹ãããããµã€ãã®æ¬¡ã®ããŒãžã«ç§»åãããšããã©ãŠã¶ã®ãã£ãã·ã¥ã«ã¯å¿
èŠãªãã¡ã€ã«ããã§ã«å«ãŸããŠããããããã©ãŠã¶ã§ããããå床ããŠã³ããŒãããå¿
èŠã¯ãããŸããã ãããã£ãŠããµã€ãã®èªã¿èŸŒã¿é床ãåäžããŸãã
ãããã£ãŠãå¯èœãªéããæ°æ¥ãŸãã¯æ°ãæåã«Expires HTTPããããŒãèšå®ããŠãã ããã Apache WebãµãŒããŒãæšå¥šäºé
ã«æºæ ããExpires HTTPããããŒãæäŸããã«ã¯ããµã€ãã®ã«ãŒããã©ã«ããŒã«ãã.htaccessãã¡ã€ã«ã«æ¬¡ã®è¡ãè¿œå ããå¿
èŠããããŸãã
<IfModule mod_expires.c> Header append Cache-Control "public" FileETag MTime Size ExpiresActive On ExpiresDefault "access plus 0 minutes" ExpiresByType image/ico "access plus 1 years" ExpiresByType text/css "access plus 1 years" ExpiresByType text/javascript "access plus 1 years" ExpiresByType image/gif "access plus 1 years" ExpiresByType image/jpg "access plus 1 years" ExpiresByType image/jpeg "access plus 1 years" ExpiresByType image/bmp "access plus 1 years" ExpiresByType image/png "access plus 1 years" </IfModule>
Apache WebãµãŒããŒæ§æãã¡ã€ã«ã®ãã®ãã©ã°ã¡ã³ãã¯ãmod_expiresã¢ãžã¥ãŒã«ã®ååšã確èªããmod_expiresã¢ãžã¥ãŒã«ã䜿çšå¯èœãªå ŽåãExpires HTTPããããŒã®é
ä¿¡ãæå¹ã«ããŸããããã«ããããã©ãŠã¶ãŒããã³ãããã·ãµãŒããŒã®ãã£ãã·ã¥å
ã®äžèšãªããžã§ã¯ãã®æå¹æéãæåã®ããŒãã®ç¬éãã1幎ã«èšå®ãããŸãã ãã®ãã©ãŠã¶ãã£ãã·ã¥ã®æå¹æéãèšå®ãããšããã¡ã€ã«ã®æŽæ°ãå°é£ã«ãªãå ŽåããããŸãã ãããã£ãŠãcssãã¡ã€ã«ãŸãã¯javascriptãã¡ã€ã«ã®å
容ãå€æŽãããããã®å€æŽããã©ãŠã¶ãŒãã£ãã·ã¥ã§æŽæ°ããå Žåã¯ããã¡ã€ã«èªäœã®ååãå€æŽããå¿
èŠããããŸãã éåžžããã¡ã€ã«ããŒãžã§ã³ã¯ãã¡ã€ã«ã®ååã«è¿œå ãããŸããäŸïŒstyles.v1.css
7. CDNã䜿çšããŠäžè¬çãªJavaScriptã©ã€ãã©ãªãããŒããããµã€ãã§jQueryãªã©ã®äžè¬çãªjavascriptãã¬ãŒã ã¯ãŒã¯ã䜿çšããŠããå ŽåãCDNã䜿çšããŠæ¥ç¶ããããšããå§ãããŸãã
CDN ïŒã³ã³ãã³ãé
ä¿¡ãããã¯ãŒã¯ïŒã¯ãå°ççã«åæ£ããå€æ°ã®WebãµãŒããŒã§ãããã¯ã©ã€ã¢ã³ããžã®ã³ã³ãã³ãé
ä¿¡ã®æ倧é床ãå®çŸããŸãã ãŠãŒã¶ãŒã«ã³ã³ãã³ããçŽæ¥é
ä¿¡ãããµãŒããŒã¯ãããã€ãã®ææšã«åºã¥ããŠéžæãããŸãã ããšãã°ãäžéã®åžææ°ãæãå°ãªããµãŒããŒããŸãã¯å¿çæéãæãçããµãŒããŒãéžæããŸãã ããã«ããã©ãŠã¶ã¯javascriptãã¡ã€ã«ããã£ãã·ã¥ããŸãããã®ã¡ãœããã䜿çšãããµã€ãã«ã¢ã¯ã»ã¹ããå Žåããã®ã©ã€ãã©ãªã¯æ¢ã«ãã©ãŠã¶ã®ãã£ãã·ã¥ã«ãããå床èªã¿èŸŒãŸããŸããã
ãã®ãããªCDNã®1ã€ãGoogle Librariesã§ãã ããã¯ã人æ°ã®ãããªãŒãã³ãœãŒã¹JavaScriptã©ã€ãã©ãªã®CDNã§ãã Google Librariesãã人æ°ã®ããJavaScriptãã¬ãŒã ã¯ãŒã¯ãããŠã³ããŒããããšãããŒãžã®èªã¿èŸŒã¿é床ãäžãããµãŒããŒãžã®ãã©ãã£ãã¯ãæžããããšãã§ããŸãã
GoogleãªããžããªããjQueryãããŠã³ããŒãããæ¹æ³ã«ã€ããŠã¯ããã®èšäº
ãGoogleãªããžããªããjQueryãããŒãããããšã§ããŒãžã®ããŒãé床ãåäžãããŸããã§èª¬æããŸãã ã
8.ç»åãæé©åããç»åã«é©ãã圢åŒã決å®ããå¿
èŠããããŸãã ééã£ãç»å圢åŒãéžæãããšããã¡ã€ã«ãµã€ãºã倧å¹
ã«å¢å ããå¯èœæ§ããããŸãã
- GIF-ããŽãªã©ãè€æ°ã®è²ãæã€ç»åã«æé©ã§ãã
- JPEG-åçãªã©ãè²ã®å€ã詳现ãªç»åã«æé©ã§ãã
- PNGã¯ãéæ床ã®ããé«å質ã®ç»åãå¿
èŠãªå Žåã«éžæããŸãã
ç»åãæé©åããã«ã¯ãã€ã³ã¿ãŒãããäžã®ããã°ã©ã ãŸãã¯ãªã³ã©ã€ã³ãµãŒãã¹ã䜿çšããŠç»åãå§çž®ãã2ã€ã®æ¹æ³ããããŸãã åè
ã®å Žåãç¹å®ã®ããã°ã©ã ã䜿çšããã«ã¯ç¹å®ã®ç¥èãå¿
èŠã§ããã誰ã§ããªã³ã©ã€ã³ãµãŒãã¹ã䜿çšã§ããŸãã å¿
èŠãªç»åãããŠã³ããŒãããã ãã§ããµãŒãã¹èªäœãããããæé©åããæ¢ã«å§çž®ããããã¡ã€ã«ãããŠã³ããŒãããããã®ãªã³ã¯ãæäŸããŸãã
ãªã³ã©ã€ã³ç»åæé©åãµãŒãã¹ã®äžéšã次ã«ç€ºããŸãã
9.ç»åãæ¡å€§çž®å°ããªãã§ãã ããã¿ã°ã®å¹
ãšé«ãã®å±æ§ã䜿çšããŠããŸãã¯CSSã䜿çšããŠç»åã®ãµã€ãºãå€æŽããªãã§ãã ããã ããã¯ãããŒãžã®èªã¿èŸŒã¿é床ã«ãæªåœ±é¿ãåãŒããŸãã 500x500pxã®ãµã€ãºã®ç»åãããã100x100pxã®ãµã€ãºã®ç»åããµã€ãã«æ¿å
¥ããå Žåã¯ãPhotoshopã°ã©ãã£ãã¯ãšãã£ã¿ãŒãªã©ã䜿çšããŠå
ã®ç»åã®ãµã€ãºãå€æŽããããšããå§ãããŸãã ç»åã®éã¿ãå°ããã»ã©ãããŠã³ããŒãã«ãããæéãçããªããŸãã
10. gzipå§çž®ã䜿çšãã調æ»ã瀺ããããã«ã95ã98ïŒ
ã®ã±ãŒã¹ã§ããã¹ããã¡ã€ã«ãããªã³ã¶ãã©ã€ãã§gzipå§çž®ãããšããã¡ã€ã«ããã©ãŠã¶ã«è»¢éããã®ã«ãããæéãççž®ã§ããŸãã ã¢ãŒã«ã€ãããããã¡ã€ã«ã®ã³ããŒããµãŒããŒïŒãããã·ãµãŒããŒã®ã¡ã¢ãªãŸãã¯åã«ãã£ã¹ã¯ïŒã«ä¿åãããšãäžè¬ã«æ¥ç¶ã3ã4åéã解æŸãããŸãã
HTTP / 1.1ãããã³ã«ããŒãžã§ã³ä»¥éãWebã¯ã©ã€ã¢ã³ãã¯ãHTTPèŠæ±ã§Accept-EncodingããããŒãèšå®ããããšã«ããããµããŒãããå§çž®ã®çš®é¡ã瀺ããŸãã
Accept-EncodingïŒgzipãdeflate
WebãµãŒããŒããªã¯ãšã¹ãã§ãã®ãããªããããŒãæ€åºããå Žåãã¯ã©ã€ã¢ã³ãã«ãã£ãŠãªã¹ããããã¡ãœããã®ããããã䜿çšããŠå¿çå§çž®ãé©çšã§ããŸãã Content-EncodingããããŒãä»ããŠå¿çãçºè¡ãããšããµãŒããŒã¯ãå¿çãå§çž®ãããã¡ãœãããã¯ã©ã€ã¢ã³ãã«éç¥ããŸãã
ã³ã³ãã³ããšã³ã³ãŒãã£ã³ã°ïŒgzip
ãã®æ¹æ³ã§éä¿¡ãããããŒã¿ã¯å
ã®ããŒã¿ã®çŽ5åå°ãããããã«ããé
ä¿¡ã倧å¹
ã«é«éåãããŸãã ãã ãã1ã€ã®æ¬ ç¹ããããŸããWebãµãŒããŒã®è² è·ãå¢å ããŸãã ãã ãããµãŒããŒã®åé¡ã¯ãã€ã§ã解決ã§ããŸãã ãããã£ãŠãããã«ã¯æ³šæãæããŸããã
ãµã€ãã§GZIPå§çž®ãæå¹ã«ããã«ã¯ã.htaccessãã¡ã€ã«ã«æ¬¡ã®ã³ãŒãè¡ãèšè¿°ããå¿
èŠããããŸãã
<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/css <IfModule mod_setenvif.c> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule> </IfModule>
ãã®ã¡ãœãããæ©èœããå Žåã¯ãåé¡ããªããã°ã次ã®ããã«ãã®ã³ãŒããè©Šãããšãã§ããŸãã
<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html <ifmodule mod_gzip.c> mod_gzip_on Yes mod_gzip_item_include file \.js$ mod_gzip_item_include file \.css$ </ifmodule> </IfModule>
ãã ãããã®ã³ãŒãã¯ãã¹ãŠã®ãµãŒããŒã§æ©èœããããã§ã¯ãªãããããã¹ãã£ã³ã°ãããã€ããŒã®ãµããŒããµãŒãã¹ã«é£çµ¡ããŠããã®åé¡ãæ確ã«ããããšããå§ãããŸãã
ããŠãç§ãäŒãããã£ãã®ã¯ããã ãã§ãã ãã®èšäºã§ã¯ãWebããŒãžã®èªã¿èŸŒã¿é床ãäžããããã«ãã¯ã©ã€ã¢ã³ãæé©åã®ãã¹ãŠã®äž»èŠãªæ¹æ³ããªã¹ãããããšããŸããã ã¯ã©ã€ã¢ã³ãã®æé©åã«å ããŠããµãŒããŒã®æé©åããããŸãã ããããããã¯å¥ã®èšäºã®ãããã¯ã§ãã
ããªããäœããèŠéããããäœãè¿œå ãããããšããããªãããã®æçš¿ãžã®ã³ã¡ã³ãã«ããªãã®æèŠãæžããŠãã ããã ãæž
èŽããããšãããããŸããïŒ