Non www domain name resolves to www intermittently

November 26, 2013 3k views
My site is www.recipehearth.com, the domain name with the "www" resolves fine every time. If you type in only: recipehearth.com , it will either take you to a blank screen or occasionally it will resolve correctly to http://www.recipehearth.com as it is supposed to. The fact that the domain recipehearth.com does not resolve correctly to www.recipehearth.com every time is what my problem is. Setup: WordPress 3.7.1 LAMP stack (Ubuntu 12.10) What I've done so far: -Activated htaccess in Apache (https://www.digitalocean.com/community/articles/how-to-use-the-htaccess-file) -Reviewed my htaccess file and made sure I am using the standard configuration.
# BEGIN WordPress 
 
RewriteEngine On 
RewriteBase /
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 

 # END WordPress
Not sure if this matters: -If you tell it to go to a page/or login such as recipehearth.com/blueberry-sorbet-macarons/ it will go with no issues, even though the www is not in the address. -My site is not located in /var/www it is in /home/wordpress/public_html Any thoughts or ideas on what this could be are appreciated!
7 Answers
The htaccess file also contains "IfModule mod_rewrite.c" before "RewriteEngine On" and "/IfModule" before "# END WordPress". It disappeared above when I posted the question, but it is in the server file.
The htaccess file also contains "IfModule mod_rewrite.c" before "RewriteEngine On" and "/IfModule" before "# END WordPress". It disappeared above when I posted the question, but it is in the server file.
Did you follow a tutorial when you installed WordPress? If so, which one?
Didn't use a tutorial for install. The droplet was setup with WordPress on Ubuntu 12.10, I then went in and did the bare minimum to get wordpress running and used a back-up restore plugin, Updraft Plus, to migrate my site.
Yes, I've seen that tutorial. The only item that was of help in it was regarding the apache configuration file in /etc/apache2/sites-enabled/www.recipehearth.com. I made two changes; 1)Servername www.recipehearth.com 2) ServerAlias recipehearth.com (oddly recipehearth.com was resolving just fine shortly after making the adjustment to this file, now it is back to being intermittent)

Was there something else you were trying to point out?
When you created your cloud server, what hostname did you assign to your droplet in the DigitalOcean control panel? You may need to swap the values for your ServerName and ServerAlias directives, if you specified a hostname of recipehearth.com.

Then, execute:
sudo service apache2 restart
Have another answer? Share your knowledge.