My Site's www is working, but non-www is not.

Hey all. I'm pretty new to web dev in general and I'm sure this is a newbie question.

My website is www.rossrando.com (rossrando.com). My www is working fine, but my non-www brings me to the "Apache2 Ubuntu Default Page".

I did search extensively through previous posts. I added the Server Alias and the A record for the non-www. It still isn't working.

I'm using Linux, Apache, and Ubuntu.

Any idea on where to go from here?

7 Replies

Did you reload/restart your webserver after editing the vhost? If so, please share the vhost.

Sorry. Didn't see your message until now.

Virtual host 443 (after I added SSL certs).

ServerName www.rossrando.com
ServerAlias rossrando.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/

the A record for the non-www

From where I am, the www resolves in DNS, but the non-www does not.

In fact it doesn't resolve from anywhere:

https://dnschecker.org/#A/rossrando.com

I suggest you double check your A record in DNS manager.

Thanks for the response.

Yes, I'm aware of this. I've tried changing the A Record multiple times. It seems straightforward (leaving the hostname blank and using my www IP address), but it's not working.

I've searched all over the internet and cannot seem to find any reason why this shouldn't be working.

Do you have any other ideas?

Linode Staff

I ran a dig on your domain name without the www and was able to get a response. I'm also currently able to visit your site without entering the www prefix in my browser. This may have been a DNS propagation issue after the A record was changed as opposed to a vhost issue.

Thanks for the response.

Yes, I ended up fixing it about an hour ago. I created a 301 redirect from the non-www to the www prior to the https redirect code.

@pietro
did you do that in the nginx sites-enabled file like so:

server {
        server_name example.com;
        return 301 $scheme://www.example.com$request_uri;
} 

?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct