<?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>vandenbos.org &#187; zend_tool</title>
	<atom:link href="http://blog.vandenbos.org/tag/zend_tool/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.vandenbos.org</link>
	<description>Matthijs van den Bos&#039; thoughts on web development topics</description>
	<lastBuildDate>Mon, 08 Feb 2010 08:11:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Zend Framework: htaccess url rewrite infinite loop</title>
		<link>http://blog.vandenbos.org/2009/07/22/zend-framework-htaccess-url-rewrite-infinite-loop/</link>
		<comments>http://blog.vandenbos.org/2009/07/22/zend-framework-htaccess-url-rewrite-infinite-loop/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 21:59:42 +0000</pubDate>
		<dc:creator>Matthijs</dc:creator>
				<category><![CDATA[zend framework]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[zend_tool]]></category>

		<guid isPermaLink="false">http://blog.vandenbos.org/?p=136</guid>
		<description><![CDATA[Just a short one this time. This is something I encountered at work today.
I started a new ZF project in our development environment, which makes use of dynamic virtualhosts.
When I started the application for the first time in the browser, I got an internal server error.
Of course I didn&#8217;t expect this. So I had a [...]]]></description>
			<content:encoded><![CDATA[<p>Just a short one this time. This is something I encountered at work today.<br />
I started a new ZF project in our development environment, which makes use of dynamic virtualhosts.<br />
When I started the application for the first time in the browser, I got an internal server error.</p>
<p>Of course I didn&#8217;t expect this. So I had a look at the apache logs and found entries like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>Wed Jul <span style="color: #cc66cc;">22</span> <span style="color: #cc66cc;">16</span><span style="color: #339933;">:</span><span style="color: #208080;">00</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">2009</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#91;</span>debug<span style="color: #009900;">&#93;</span> core<span style="color: #339933;">.</span>c<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3052</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>client 192<span style="color: #339933;">.</span>168<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>7<span style="color: #009900;">&#93;</span> redirected from r<span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span> <span style="color: #339933;">=</span> <span style="color: #339933;">/</span>data<span style="color: #339933;">/</span>virtualhosts<span style="color: #339933;">/</span>dev<span style="color: #339933;">/...</span></pre></div></div>

<p>After some googling, I found out this has something to do with having apache rewrite rules in combination with dynamic virtualhosts. Then I had a look at an older ZF project on the same server and found a small but significant difference:</p>
<p>Standard .htaccess created by Zend_Tool:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">SetEnv</span> APPLICATION_ENV development
&nbsp;
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -s [OR]
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -l [OR]
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -d
<span style="color: #00007f;">RewriteRule</span> ^.*$ - [NC,L]
<span style="color: #00007f;">RewriteRule</span> ^.*$ index.php [NC,L]</pre></div></div>

<p>And here is the last line of the older .htaccess, the rest is identical:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteRule</span> ^.*$ /index.php [NC,L]</pre></div></div>

<p>Notice the difference? There is a forward slash before index.php in the working .htaccess.<br />
I simply added the forward slash in the non-working htaccess, and everything worked fine!</p>
<p>Note: this may not work for you, as I have seen articles where REMOVING the forward slash was the solution. It is entirely dependent on your specific apache config and more importantly, your apache version. This is because there have been changes in how apache matches redirects in recent releases.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vandenbos.org/2009/07/22/zend-framework-htaccess-url-rewrite-infinite-loop/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
