Why is my no-www redirect taking over 2 seconds?

Why is my no-www redirect taking over 2 seconds? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Why is my no-www redirect taking over 2 seconds? error on your web browser. Problem :


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 www.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?


Solution :

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


In httpd.conf look for a rule like this one:



< VirtualHost www.domain.com >
Redirect 301 / http://domain.com/
< /VirtualHost >


In .htaccess look for a rule that looks like:



RewriteCond %HTTP_HOST ^www.domain.com [NC]
RewriteRule (.*) http://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:



enter image description here



I would recommend using tools like firebug and sites like the one you're using or this one to find the real problem.



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 ^(.*)$ http://livingalignment.com/$1 [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.



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 ^(.*)$ https://%HTTP_HOST/$1 [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 ^(.*)$ https://%HTTP_HOST/$1 [R=301,L]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

We hope that this article has helped you resolve the redirects, no-www, error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=