<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Code in the hole (Entries tagged as apache)</title>
    <link>http://codeinthehole.com/</link>
    <description>David Winterbottom</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.3.1 - http://www.s9y.org/</generator>
    
    

<item>
    <title>High Performance Web Sites by Steve Souders</title>
    <link>http://codeinthehole.com/archives/9-High-Performance-Web-Sites-by-Steve-Souders.html</link>
            <category>Books</category>
    
    <comments>http://codeinthehole.com/archives/9-High-Performance-Web-Sites-by-Steve-Souders.html#comments</comments>
    <wfw:comment>http://codeinthehole.com/wfwcomment.php?cid=9</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://codeinthehole.com/rss.php?version=2.0&amp;type=comments&amp;cid=9</wfw:commentRss>
    

    <author>nospam@example.com (David Winterbottom)</author>
    <content:encoded>
    &lt;div class=&quot;book_cover&quot;&gt;
&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.amazon.co.uk/gp/product/0596529309?ie=UTF8&amp;amp;tag=codinthehol-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=0596529309&#039;);&quot;  href=&quot;http://www.amazon.co.uk/gp/product/0596529309?ie=UTF8&amp;tag=codinthehol-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=0596529309&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://codeinthehole.com/app/images/books/high-performance-web-sites.jpg&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.co.uk/e/ir?t=codinthehol-21&amp;l=as2&amp;o=2&amp;a=0596529309&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;High Performance Web Sites (HPWS) is essentially a book-length exposition of the &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/developer.yahoo.com/yslow/&#039;);&quot;  href=&quot;http://developer.yahoo.com/yslow/&quot; title=&quot;Visit the YSlow homepage&quot;&gt;YSlow extension to Firebug&lt;/a&gt; augmented with case studies of popular US websites.  YSlow itself links to some &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/developer.yahoo.com/performance/rules.html&#039;);&quot;  href=&quot;http://developer.yahoo.com/performance/rules.html&quot; title=&quot;The Yahoo guidance pages&quot;&gt;explanation paragraphs&lt;/a&gt; regarding the various guidelines that are used to grade the performance of a website.  However, even for those familiar with this documentation, HPWS is still an excellent resource on how the performance of a web app can be tuned.&lt;/p&gt; 
&lt;p&gt;Chapter by chapter, HPWS introduces a new guideline and expounds the underlying rationale, giving illustrations of the HTTP requests with and without the suggested improvement.  For instance, the use of far-future Expires HTTP headers is an easy-win recommendation that prevents unnecessary requests once a browser&#039;s cache has been primed.  This is something I&#039;ve used on several sites previously, employing the following Apache directives to add Expires headers to the HTTP:&lt;/p&gt;
&lt;div class=&quot;apache&quot; style=&quot;text-align: left&quot;&gt;&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #00007f;&quot;&gt;ExpiresActive&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;on&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #00007f;&quot;&gt;ExpiresByType&lt;/span&gt; image/jpg “access plus &lt;span style=&quot;color: #ff0000;&quot;&gt;2&lt;/span&gt; years”&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #00007f;&quot;&gt;ExpiresByType&lt;/span&gt; image/jpeg “access plus &lt;span style=&quot;color: #ff0000;&quot;&gt;2&lt;/span&gt; years”&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #00007f;&quot;&gt;ExpiresByType&lt;/span&gt; image/gif “access plus &lt;span style=&quot;color: #ff0000;&quot;&gt;2&lt;/span&gt; years”&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #00007f;&quot;&gt;ExpiresByType&lt;/span&gt; text/css “access plus &lt;span style=&quot;color: #ff0000;&quot;&gt;2&lt;/span&gt; days”&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #00007f;&quot;&gt;ExpiresByType&lt;/span&gt; image/js “access plus &lt;span style=&quot;color: #ff0000;&quot;&gt;2&lt;/span&gt; days”&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #00007f;&quot;&gt;ExpiresDefault&lt;/span&gt; ”access plus &lt;span style=&quot;color: #ff0000;&quot;&gt;1&lt;/span&gt; days”&lt;br /&gt;&amp;#160;&amp;lt;/IfModule&amp;gt;&lt;/div&gt;
&lt;p&gt;
Additional areas where I found out something new include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The performance hit that using @import directives within CSS files has.&lt;/li&gt;
&lt;li&gt;How the &quot;Cache control&quot; and &quot;Etags&quot; HTTP headers are often interpreted together by browsers to determine whether to make a request.&lt;/li&gt;
&lt;li&gt;How the choice of domains to use for serving content must be balanced against the extra DNS look-up costs that each new domain incurs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Many of the performance guidelines can be adhered to easily, by making a few adjustments to the Apache configuration of your site;  However, some performance-enhancing measures come at a cost to the development process (such as keeping all javascript in one large, minified file).  Such costs can be mitigated by having a careful one-step build process that handles the conversion of easy-to-use development files to more performance-savvy production files.  Nevertheless, in many cases, one has to decide where the balance between performance and inconvenience in development lies.
&lt;/p&gt;
&lt;p&gt;
It&#039;s quite a short book at 137 pages, but definitely a worthwhile addition to any company library.  
&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 06 Dec 2008 22:00:00 +0000</pubDate>
    <guid isPermaLink="false">http://codeinthehole.com/archives/9-guid.html</guid>
    <category>apache</category>
<category>http</category>
<category>optimisation</category>

</item>
<item>
    <title>Date-conditional redirects with mod_rewrite</title>
    <link>http://codeinthehole.com/archives/4-Date-conditional-redirects-with-mod_rewrite.html</link>
            <category>Tidbits</category>
    
    <comments>http://codeinthehole.com/archives/4-Date-conditional-redirects-with-mod_rewrite.html#comments</comments>
    <wfw:comment>http://codeinthehole.com/wfwcomment.php?cid=4</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeinthehole.com/rss.php?version=2.0&amp;type=comments&amp;cid=4</wfw:commentRss>
    

    <author>nospam@example.com (David Winterbottom)</author>
    <content:encoded>
    &lt;p&gt;The Apache module mod_rewite is capable of some very cool stuff.  One neat trick is to use the time and date variables to control redirects and URL rewriting.  This is useful if you have a URL that you don&#039;t want to be exposed to the world until a certain date has passed - this could be the case with special offers and competitions which have a one-off static page that isn&#039;t to be revealed until a specified date.&lt;/p&gt;
&lt;p&gt;
For example, the following directives specify that a temporary 302 redirect should be issued for all requests to the URL /special_offer before a certain date has passed: &lt;/p&gt;
&lt;div class=&quot;apache&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #00007f;&quot;&gt;RewriteCond&lt;/span&gt; %&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;TIME&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &amp;lt;&lt;span style=&quot;color: #ff0000;&quot;&gt;20081031000000&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00007f;&quot;&gt;RewriteCond&lt;/span&gt; %&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;REQUEST_URI&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; /special_offer.* &lt;br /&gt;&lt;span style=&quot;color: #00007f;&quot;&gt;RewriteRule&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;.*&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; /offers &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;L,R=&lt;span style=&quot;color: #ff0000;&quot;&gt;302&lt;/span&gt;,QSA&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;
This means that the /special_offer page can be prepared and deployed beforehand and apache will handle the transfer once the publish date has passed.  There&#039;s &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html&#039;);&quot;  href=&quot;http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html&quot; title=&quot;Lots of other cool mod_rewrite tricks&quot;&gt;a whole load of other nifty things that can be done in a similar vein&lt;/a&gt; such as returning different style sheets depending on the time of day.  &lt;/p&gt;
&lt;p&gt;
Digressing briefly, debugging Apache directives can be quite tricky when you&#039;re playing around trying to get something to work.  I find the easiest thing to do is to redirect to a URL which contains the variable being tested against. For example: &lt;/p&gt;
&lt;div class=&quot;apache&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #00007f;&quot;&gt;RewriteEngine&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;On&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00007f;&quot;&gt;RewriteCond&lt;/span&gt; %&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;REQUEST_URI&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; /debug &lt;br /&gt;&lt;span style=&quot;color: #00007f;&quot;&gt;RewriteRule&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;.*&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; /debug/?%&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;TIME&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&amp;amp;%&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;TIME_DAY&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;L,R=&lt;span style=&quot;color: #ff0000;&quot;&gt;302&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;
Then you can see what the values of %{TIME} and %{TIME_DAY} are from the URL you&#039;ve been redirected to.  There are almost certainly better ways of doing this but this way is quick and it works.
&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 31 Oct 2008 13:48:41 +0000</pubDate>
    <guid isPermaLink="false">http://codeinthehole.com/archives/4-guid.html</guid>
    <category>apache</category>
<category>mod_rewrite</category>

</item>

</channel>
</rss>