Apache passthru rewriting

Martin F. nofearroxo at gmail.com
Tue Feb 24 01:44:03 MSK 2009


Sorry for adding yet another rewrite thread, but I did a few searching and
couldn't find anything about replicating passthru behaviour.

The idea is to take something like this:

domain.com/news/254/ and redirect it to domain.com/index.php/news/254/

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 this:

[error] 29870#0: *45 "/home/entrom/public_html/index.php/news/index.php" is
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 really
very big on doing.

Thanks in advance,
Martin Fjordvald
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090223/371e286e/attachment.html>


More information about the nginx mailing list