When working on clients’ sites, I often see that many use www.domain.com for WordPress Address and Site Address (you’ll find these settings in your WP Admin Dashboard under Settings > General). However, most people never type in www when visiting our sites. And if that’s the case, then they get redirected from domain.com (called "root" or "naked" domain) to www.domain.com. Depending on your Domain Name Server and your server response time, this redirect can take tens or hundreds of milliseconds and I’ve seen it increase loading time by as much as a second or two on some servers.
You can speed up your WordPress site by removing this 301 redirect. To do that, we need to change our setup in WP Admin and change DNS records accordingly.
If you’re a WordPress Speed Secrets member and using Cloudflare, here’s an example of what your DNS records should look like. Your A record is your naked domain pointing to your server IP address. Your www subdomain is a CNAME as an alias of the naked domain. This way all your traffic is directed to your naked domain, regardless of how they type in your site URL. There are no redirects and your site loads faster.
To make this work, you’ll also need to change WordPress Address and Site Address in WP Admin Dashboard from www to naked domain and make sure there is no 301 redirect in your .htaccess. If you’re using your host’s DNS, look at the DNS records and change them accordingly.
Warning: If your site has been around for a while and is indexed by Google as www.yourdomain.com, changing the site URL can have negative SEO implications and, in most cases, should never be done. Google treats every subdomain as a separate website.
That’s how you speed up your WordPress site by removing unnecessary redirects. And if you’d like to get your site blazing fast in under 2 hours, sign up for my WordPress Speed Secrets video tutorial. Cheers!