<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Straylight Run &#187; htaccess</title> <atom:link href="http://blog.straylightrun.net/tag/htaccess/feed/" rel="self" type="application/rss+xml" /><link>http://blog.straylightrun.net</link> <description>Software, Technology, PHP</description> <lastBuildDate>Wed, 25 Apr 2012 16:11:41 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Tip Of The Day: Removing .htaccess</title><link>http://blog.straylightrun.net/2009/06/17/tip-of-the-day-removing-htaccess/</link> <comments>http://blog.straylightrun.net/2009/06/17/tip-of-the-day-removing-htaccess/#comments</comments> <pubDate>Wed, 17 Jun 2009 20:48:21 +0000</pubDate> <dc:creator>gerard</dc:creator> <category><![CDATA[Performance]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[htaccess]]></category> <category><![CDATA[tips]]></category> <guid
isPermaLink="false">http://blog.straylightrun.net/?p=205</guid> <description><![CDATA[At work, every project has an .htaccess file containing at the least some mod_rewrite rules.  This way, all I need to do to run a project is check it out of version control.  I don&#8217;t need to modify my local Apache configuration. But turning this option on and allowing .htaccess files may be a performance [...]]]></description> <content:encoded><![CDATA[<p>At work, every project has an <code>.htaccess</code> file containing at the least some <code>mod_rewrite </code>rules.  This way, all I need to do to run a project is check it out of version control.  I don&#8217;t need to modify my local Apache configuration.</p><p>But turning this option on and allowing <code>.htaccess</code> files may be a performance hit.  More specifically, enabling the <code><a
href="http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride">AllowOverride</a> </code>option in Apache is a performance hit.  The <a
href="http://httpd.apache.org/docs/2.2/misc/perf-tuning.html">Apache docs</a> sums up the problem best:</p><blockquote><p> &#8220;Wherever in your URL-space you allow overrides (typically <code>.htaccess</code> files) Apache will attempt to open <code>.htaccess</code> for each filename component. For example,</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
</pre></td><td
class="code"><pre class="xml" style="font-family:monospace;">DocumentRoot /www/htdocs
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Directory</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   AllowOverride all
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div><p>and a request is made for the URI <code>/index.html</code>. Then Apache will attempt to open <code>/.htaccess</code>, <code>/www/.htaccess</code>, and <code>/www/htdocs/.htaccess</code>.&#8221;</p></blockquote><p>So I disabled all <code>.htaccess </code>files in production, and inserted each file&#8217;s individual <code>mod_rewrite </code>rules into the main Apache config file. After a quick <a
href="http://blog.straylightrun.net/2009/04/23/apache-bench/">Apache Bench</a> run, one project looked around 3% faster. Note that there are a few other useful optimizations on that page.</p> ]]></content:encoded> <wfw:commentRss>http://blog.straylightrun.net/2009/06/17/tip-of-the-day-removing-htaccess/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
