Rewrite PHP block older browsers

leeus nginx-forum at
Wed Aug 8 11:24:39 UTC 2012

I have the following config file that works for everything but PHP

I am trying to get everything as an ancient_browser to add /IE/ in the
URL. Essentially changing the root for these clients although you cannot
set this within an if.  This is working for anything not .php and loads
the content silently from the /IE/ content.

If I add the rewrite within the PHP location it doesn't work either. Any

location / {
    if ($ancient_browser) {
        rewrite  ^(.*)$ /IE/$1 break;
    try_files $uri $uri/ /index.php;

location ~ \.php$ {
            include /etc/nginx/fastcgi_params;
            fastcgi_index index.php;
            if (-f $request_filename) {

Posted at Nginx Forum:,229437,229437#msg-229437

More information about the nginx mailing list