: Why is my no-www redirect taking over 2 seconds? My website livingalignment.com is very slow to load. The domain and hosting is all with GoDaddy. In Pingdom I found that it is redirecting from
My website livingalignment.com is very slow to load. The domain and hosting is all with GoDaddy. In Pingdom I found that it is redirecting from livingalignment.com to livingalignment.com and it takes about 2 seconds to do so, with a total load time of 10 seconds. If put in livingalignment.com then it takes about 4 seconds.
What should I do to fix this?
More posts by @Correia994
3 Comments
Sorted by latest first Latest Oldest Best
Yeah, what @alfasin said is right.
I use WordPress powered website and I want to force my URL to www & HTTPS version. I use ReallySimpleSSL plugin v2.2.12.
The plugin add these code to my root .htaccess
# BEGIN rlrssslReallySimpleSSL rsssl_version[2.2.12]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ %{HTTP_HOST}/ [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL
It takes 2-5 second to redirecting to www version, when i'm visiting from non-www version.
And after i add what @alfasin suggest above, it doesn't take any second for now.
Great, i'm very happy with it.
So, here is what my .htaccess now
# BEGIN rlrssslReallySimpleSSL rsssl_version[2.2.12]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC] #RewriteRule ^(.*)$ %{HTTP_HOST}/ [R=301,L]
RewriteRule ^(.*)$ www.example.com/ [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL
As alfasin correctly notes, you have at least two problems. The first is that you're issuing the redirects from within WordPress, which means that the entire WP app needs to start up just to return that redirect. The second problem is that it's clearly taking quite a bit of time to do so.
To solve the first problem, you should let Apache generate the redirect directly. Putting the following code into the .htaccess file in your www root directory should do it:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !=livingalignment.com [NC]
RewriteRule ^(.*)$ livingalignment.com/ [R=301,L]
As for the second problem, the first thing to do, if you haven't already done so, is to install and use a PHP accelerator such as APC — that's always good advice for any large PHP app. Also make sure that the PHP interpreter is being run either via FastCGI or directly as an Apache module; running PHP as a traditional CGI script is dead slow and eliminates most of the advantages of acceleration.
There are other things you can do to make WordPress faster, such as installing a cache plugin. You seem to be already using W3 Total Cache, which seems to be well regarded, so that's OK. Note that just installing it isn't enough, though — to get optimal performance, you need to adjust the settings to fit your site.
There are also plenty of other things you can do, but since I'm not really an expert on WordPress performance tuning or optimization, and would rather not try to write a complete tutorial on it, I'll just suggest Googling for it and going through the results — many of them looked at least promising to me at a glance.
Look for 301 redirection rules in your .htaccess or in httpd.conf.
In httpd.conf look for a rule like this one:
< VirtualHost domain.com >
Redirect 301 / domain.com/ < /VirtualHost >
In .htaccess look for a rule that looks like:
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule (.*) domain.com%{REQUEST_URI} [R=301,L]
Remark them. if it's in httpd.conf - restart apache by running: service httpd restart
That said, I don't think that this is the reason for the slowness of your web-site.
Checking the links that you provided, and drilling abit more down you can see the following:
I would recommend using tools like firebug and sites like the one you're using or this one to find the real problem.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.