Forum: NGINX Apache passthru rewriting

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Martin F. (Guest)
on 2009-02-24 00:51
(Received via mailing list)
Sorry for adding yet another rewrite thread, but I did a few searching
couldn't find anything about replicating passthru behaviour.

The idea is to take something like this: and redirect it to

In apache rewriting this is simple enough like this:

RewriteRule ^(.*)$ index.php/$1 [PT,L]

I tried this in nginx:

location / {
    if (!-f $request_filename) {
        rewrite  ^(.*)$  /index.php$1? break;

This works somewhat, but nginx then applies the index order giving me

[error] 29870#0: *45 "/home/entrom/public_html/index.php/news/index.php"
not found (20: Not a directory)

Where as I want it to use the index.php in the root. I could use
index.php?q= but that will require framework rewriting that I'm not
very big on doing.

Thanks in advance,
Martin Fjordvald
Martin F. (Guest)
on 2009-02-25 01:14
(Received via mailing list)
To follow up, I figured that nginx seems to work like passthru by
default so
what I needed was:

if (!-e $request_filename) {
    rewrite ^.*$ /index.php last;

Hopefully this will help someone with the same problem.
This topic is locked and can not be replied to.