# Rewrite PHP block older browsers

**URL:** <https://www.ruby-forum.com/t/rewrite-php-block-older-browsers/221991>\
**Category:** NGINX\
**Created:** [August 8, 2012, 1:25pm UTC](https://www.ruby-forum.com/t/rewrite-php-block-older-browsers/221991 "2012-08-08T13:25:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 8, 2012, 1:25pm UTC](https://www.ruby-forum.com/t/rewrite-php-block-older-browsers/221991/1 "2012-08-08T13:25:10Z")

</div>

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

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  
ideas?

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) {  
fastcgi\_pass 127.0.0.1:9000;  
}  
}

Posted at Nginx Forum:

> **[Rewrite PHP block older browsers](https://forum.nginx.org/read.php?2,229437,229437#msg-229437)**
>
> I have the following config file that works for everything but PHP pages. 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...
