Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am on slicehost and I followed the articles that they gave for DNS redirection and the www to non www url redirection does work.

However, what if I want a www.domain.com to be the default domain. Would I put www.domain.com. as my DNS record name or would I keep domain.com. as my DNS record and then do something else.

Basically, what happens is if someone goes to the url www.domain.com/directory/something.html

they will be redirected to domain.com and not domain.com/directory/something.html

I would like the second thing to happen, not just go to domain.com and call it a day. I am running nginx and am confounded on how to solve this issue. I'm not sure whether its an nginx issue or a dns issue.

Any help would be greatly appreciated!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

From the nginx documentation:

server {
    listen       80;
    server_name  nginx.org;
    rewrite   ^  http://www.nginx.org$request_uri?;
}

server {
    listen       80;
    server_name  www.nginx.org;
    ...
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.