Long wait time to connect to webserver


#1

Hello,

I have a wordpress website which URL starts with www.

I’ve set up CF DNS with 2 A records to point to the website. Both www and non-www URL point to the same IP address. When using pingdom I see that the non-www takes almost a full second in wait time before it connects to the www domain.

Should I add a page rule as well? Or is this an issue at the ISP that hosts the webserver? Is it something I need to add in the htaccess?

Thanks,

Ryan


#2

Hey there. Based on my quick testing I believe this is either .htaccess rewrites and/or a Wordpress thing. In Wordpress General Settings you specify a default URL. (for my test I set it to ‘http://example.tld’) When using this URL on pingdom my test site loads in ~600ms. When using ‘http://www.example.tld’ on pingdom the load time increased by about 1s. I believe this 1s is Wordpress/Apache redirecting the request. Unfortunately that’s all the info I can provide right now.

Your DNS setup is fine, though some folks use a CNAME record for www but you can use an A record if you like.

Update: I tested this same scenario with Wordpress running on NGINX webserver and the difference in load times was about 100ms (for a default Wordpress install). This leads me to believe that Apache is the culprit here, though I can’t be certain. Who is your hosting provider? I’d be interested to learn more about root-cause of this extra second - possibly another :star: for NGINX.


#3

Look for 301 redirection rule in your .htaccess or httpd.conf

In httpd.conf look for something like this:

< VirtualHost www.example.tld >
      Redirect 301 / http://example.tld/
< /VirtualHost >

In .htaccess :

RewriteCond %{HTTP_HOST} ^www.example.tld [NC]
RewriteRule (.*) http://example.tld%{REQUEST_URI} [R=301,L]

Remark them.

if you have changed httpd.conf a restart is needed by:

service httpd restart


#4

Hi Andy,

The provider is mijndomein.nl but I see this very often with other providers.


#5

Xaq:

I’ve added the rewritecond & rules to my htaccess and that did the trick!