Rewrite Regular Files in Zend Framework- Error when using .htaccess

by antbrown on September 4, 2009

This was rather silly of me,

I was trying to add this line to my .htaccess:

RewriteRule ^free/download\.php /free/download/pdf [NC,L]

Not realizing that the Rewrite Conditions were completely negating my Rule.

The following will not Rewrite the URL if the Requested Filename is a regular file (example download.php)

RewriteCond %{REQUEST_FILENAME} !-f

The solution of course is to use the Zend Router to do the redirection, it’s one of those fore-head-smacking moments

I added this to my application.ini and away it went,

routes.freedownload.route = “free/download.php”
routes.freedownload.defaults.controller = “free”
routes.freedownload.defaults.action = “download”
routes.freedownload.defaults.type = “pdf”

Leave a Comment

Previous post: Zend Studio Switching Workspace closes Zend Studio

Next post: svn: Could not use external editor to fetch log message