How to remove the www from URL with nginx server

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 may like following Articles!

This entry was posted in Nginx, Open source and tagged , , , , by Wordpress API. Bookmark the permalink.

About Wordpress API

API means Application Program interface. In Wordpress API we are giving all the information about wordpress API. We worked for many wordpress plugins and themes. We have expertise in PHP, Databases, Graphic Design, Ruby on Rails, Java, Wordpress, Drupal and many CMS. We always give you the best solutions about wordpress and other related topics in This Blog. We will give you always fresh tips and tricks and techniques about wordpress in this blog.

25 thoughts on “How to remove the www from URL with nginx server

  1. Pingback: uberVU - social comments

  2. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>