Question

www not working

Posted April 22, 2014 2.6k 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

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.

×
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]
Submit an Answer