Welcome! Log In Create A New Profile

Advanced

Zend Framework Rewrites

Posted by nickp666 
Zend Framework Rewrites
May 20, 2009 10:10AM
Hi All,

I am in the process of migrating away from Apache 2.2 to nginx, I'm stuck with some rewrite rules specifcally for Zend Framework MVC apps, I have seen a few examples of how these rules have been converted but they all seem to be missing the flags for 'if directory exists' and 'if file exists', so any help would be greatly appreciated.

The standard apache rewrite is as follows:

[code]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
[/code]

Thanks in advance
Re: Zend Framework Rewrites
May 20, 2009 11:02AM
If you are checking for the existence of a file or a directory you can use:

[code]
if (-e $request_filename) {
rewrite ... ;
}
[/code]


or the absence of a requested file or directory:

[code]
if (!-e $request_filename) {
rewrite ... ;
}
[/code]



You can also use "try_files". See http://wiki.nginx.org/NginxHttpMainModule#try_files.

--
Jim Ohlstein
Re: Zend Framework Rewrites
May 20, 2009 11:27AM
Thanks so much Jim

I'll give that a try
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 139
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready