jeseph
By:
jeseph

www not working

April 22, 2014 1.8k views
I'm just getting my first wordpress droplet set up. Everything seems to be working except for the 'www' version of my domain. Domain in question - qcmny.com
1 comment
  • how did you add the cname? in the first input did you put dot(.) next to www or not? i have the same problem for my two sites.

5 Answers
First of all let me say that I like your website.
Now about the question, if you haven't add a CNAME in DNS please do. If you have then check your .htaccess file and make sure it looks like this.
Note: Haven't tried this cause I don't use Apache

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Sorry I misread your question, If you want to have only www edit your /etc/apache2/sites-available/your-web-site and add the www.
You need again to have a CNAME.
What are you using as you webserver, nginx or apache?

It looks like which ever one you use has a rewrite rule set up that redirects www.yourdomain.com to yourdoamin.com That's pretty standard practice. In fact, choosing just one or the other can be important to your page rank in web searches. So, I'd suggest leaving it as it is.
Thanks Marinos!

It looks like the CNAME may have done it, new to manually setting up DNS ;)
try to modify your .htaccess make sure you add the lines below:

# (http://www.example.com/... will be redirected to http://example.com/...)
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
Have another answer? Share your knowledge.