Apache passthru rewriting


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:

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

[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


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.