Nginx web server is becoming most popular in last year. Best server response time and minimum execution time is the advantages of Nginx server.

Many people want to remove the www from URL. I will tell you the tip how to remove the www from URL with nginx server.

Open your Ngnix configuration file (nginx.conf). Just use following code in server block.

if ($host ~* ^www\.(.*)) {
    set $remove_www $1;
    rewrite ^(.*)$ http://$remove_www$1 permanent;
}

This code will remove the www from the URL.

You might also like

How to host multiple rails site on Nginx
nginx wordpress plugins and mannual nginx setup for worpdress
How to install Nginx with PHP on Ubuntu
Nginx Rule for Rails Application
Easy Steps for setting up nginx with php on Linux

6 Responses to “How to remove the www from URL with nginx server”

  1. However, in early February I began hosting a business site there as well. Url Cloaking

  2. Social comments and analytics for this post…

    This post was mentioned on Twitter by wordpressapi: How to remove the www from URL with nginx server http://bit.ly/dgWV7g...

  3. Thank you for writing such an appealing post. Normall I see the same thing and it starts to get on my nearves. Thanks again and I’ll be back for more.

  4. This is a excellent post, but I was wondering how do I suscribe to the RSS feed?

  5. I’m happy I located this web site, I couldnt get any information on this topic before. Also manage a site and for anyone who is ever interested in doing some visitor writing for me you should feel free to let me know, i’m always look for people to check out my blog page. Please stop by and leave a comment sometime!

  6. Terrific site, where did you come up with the info in this summary? I’m glad I found it though, ill be checking back soon to see what other articles you have.

Leave a Reply

Wordpressapi is developer code book.
wordpressapi on Facebook
© 2010 Wordpressapi. All Rights Reserved. Reproduction without explicit permission is prohibited.