Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
# 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;
    }
}
share|improve this answer
    
could be a bit more specific in you example? :) – clarkk Nov 19 '15 at 12:44

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

rewrite .* /index.php;
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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