How can I send all traffic to a single index.php file regardless of path or domain? What is the fastest way to do this in nginx.conf? try_files?

Thanks for insight

link|improve this question
feedback

2 Answers

First answer that came to mind, i suppose you can put this wherever it benefits you the most.

rewrite .* /index.php;

link|improve this answer
Ok thanks but where would I put this? I want literally everything to go to index.php (error pages, directories that don't exist) – ace Nov 1 '10 at 3:12
feedback
# Assuming you want static files as well
server {
    listen 80 default_server; # Use default; instead if you're still on 0.7.x.
    try_files $uri /index.php;

    # Standard PHP location block here.
}

# Assuming you do not want static files as well
server {
    listen 80 default_server; # Use default; instead if you're still on 0.7.x.
    location = /index.php {
        # Fastcgi/proxy pass
    }

    location / {
            rewrite ^ /index.php last;
    }
}
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.