Remove URI string?

Jonathan Matthews contact at jpluscplusm.com
Wed Jan 9 16:43:36 UTC 2013


On 9 January 2013 16:35, daveyfx <nginx-forum at nginx.us> wrote:
> Hello all -
>
> I would like to strip all request_uri strings for a group of server names
> and serve up an index page.
> Example:
>
> Client requests http://host1.domain.com/blah, nginx will direct client to
> http://host1.domain.com and serve the index page.  Same scenario for host2 -
> I would like nginx to direct client to http://host2.domain.com and serve the
> same index page.
>
> Would the below work?
>
> server {
>     server_name host1.domain.com host2.domain.com;
>     rewrite ^ http://$server_name;
>     root /path/to/document/root;
>     index index.html;
> }

Have you tried it? How about doing that?

It looks ok to me, but running it on a test machine will probably tell
you all you need to know ...

Jonathan
-- 
Jonathan Matthews // Oxford, London, UK
http://www.jpluscplusm.com/contact.html



More information about the nginx mailing list