1

Let's say i have a virtual host in Nginx wtih name www.domain.com and root directory named public. Inside public i have 2 dirs dir1 and dir2. How i redirect the request to www.domain.com to dir1? I know it's a simple question, but i am new to nginx.

1 Answer 1

0

Do you want to redirect visitors from www.domain.com to www.domain.com/dir1 ?

Then you can use a rewrite statement to rewrite. When you include http:// or https:// in the rewrite it will redirect visitors.

rewrite http://www.domain.com/(.*) http://www.domain.com/$1;

If you just want to use dir1 to serve content from, you can use alias, or you can rewrite without http:// like this:

rewrite / /dir1/;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .