0

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

2 Answers 2

2
# 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;
    }
}
1
  • could be a bit more specific in you example? :)
    – clarkk
    Nov 19, 2015 at 12:44
0

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

rewrite .* /index.php;
1
  • 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, 2010 at 3:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .