1

I want to have an alias in nginx so the application does not see the version number in the request, so I do not want to rewrite that portion of the URL. For instance:

ls -la /var/www/html/source
   gives
1.0/
1.1/
1.2/

In which each of these are their own repo of Zend applications

http://www.howdydoodie.com/1.0/user/add

when this reaches the zend application, the application will see the URL as http://www.howdydoodie.com/user/add in the /var/www/html/source/1.0 directory. I know this is possible using Alias, as it works fine in apache. How would one go about configuring it in nginx automagically?

    root  /var/www/html/source;
    # the idea is to have 2 variables, version number, and the rest of the url, truncate the url to remove the version number
    # $1 = 1.2   $2=/user/add/blahblah
    location ~ ^/(.*)/(.*)$ {
        alias /var/www/html/source/$1;
        rewrite ^/(.*) /public/index.php?q=$1 last;
    }

The reason in doing this is to prevent the use of a baseurl within the application, so I want to handle this on the web server level.

Thanks!

Du3
  • 1,424
  • 6
  • 18
  • 36

0 Answers0