0
votes

I'm attempting to do the following

  • redirect non-www to www (so example.com to www.example.com) to limit the amount of network traffic resulting from browsers sending cookies for images.

I know a 301 redirect is not advisable.

Is there a way to do this using cname dns?

2

2 Answers

0
votes

If you do have access to your apache VirtualHosts configuration (http.conf) then:

<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / http://www.example.com/
</VirtualHost>

IMHO that's the best way to do it. You can't put a CNAME record on a top-level domain so straight DNS isn't a simple solution.

0
votes

If you want to redirect non-www to www then you should use a redirect. A 301 redirect is "permanent" so that is the best to use as it only needs to tell the web browser one time and the web browser then goes directly to the redirected content.