Need help with nginx rewrites (for sub-domains)

Edho P Arief edhoprima at
Fri Apr 29 14:17:14 MSD 2011

On Fri, Apr 29, 2011 at 5:01 PM, Jimish Jobanputra <lists at> wrote:
> Thanks a lot!!! That works like a charm...
> However, there is one more issue:
> If I try to go to then it takes me to
> index page itself... I tried couple of things, but no luck yet...

I guess the `location /coupons/` should go like this instead (replace
entire `location /coupons/ { }` block):

location ~ /coupons/(.*) {
 root /home/jjobanputra/code/coupon;
 try_files $uri $uri/ /coupons/index.php?q=$1;
 index index.php index.html index.htm;
 expires 30d;

More information about the nginx mailing list