Question

Trying to switch domain from non www to www

Posted May 28, 2015 1.6k views
Nginx WordPress

Hi everyone,

I really need some help…I’m a noob :)

I installed a site on DO using easyengine. I am able to get Wordpress to install and add content and such.

When I go into WP admin and change the site from nonwww to www the site crashes. The nonwww version works fine and 301’s the www version.

I am trying to follow these instructions:

https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-ubuntu-14-04

Here is my problem. I followed the instructions. I opened up Putty, logged in and entered: sudo vi /etc/nginx/sites-enabled/default

After that loads, I get some white and blue text.

I enter :

server {
listen 80;
servername example.com;
return 301 $scheme://www.example.com$request
uri;
}

Of course swapping out the example.com for my domain.

After I do that, I can’t figure out how to save the file.

I think that’s the last step where I get lost. Any advice would be greatly appreciated.

Thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hope this helps… http://www.cyberciti.biz/faq/save-file-in-vi-vim-linux-apple-macos-unix-bsd/

If you are struggling with vi, you could always try nano. I much prefer nano for text editing and I’m also n00b.

Submit an Answer