Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

301 redirect time

Options
  • 30-08-2012 5:24pm
    #1
    Registered Users Posts: 6,464 ✭✭✭


    I've got a 301 redirect set up to redirect non www versions of pages to www version, using mod_rewrite in the .htaccess.

    Doing some performance testing, and I've noticed the redirect is taking 400-500ms to return.

    i.e. looking at the waterfall chart on webpagetest.org, there's an initial connect for the non-www page, there's maybe 100ms total for DNS lookup and connection, then 300-400ms for TTFB. And that's before the www connection can start, so it's effective adding half a second to every non-www request.

    Does this seem high? Surely the server shouldn't be doing anything but instantly waving it's hand saying "this is not the page you are looking for"?
    Tagged:


Comments

  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    You should only get 1 non-www request, because it's 301 redirect - the only ways to generate that are a type-in or an incorrect link (rare - most linkers will use copy/paste). I wouldn't worry about it if it's only the non-www that's delayed and if it's only 300-400ms.

    On the other hand, a high TTFB in general is something you should talk to your host about.


  • Registered Users Posts: 6,464 ✭✭✭MOH


    I was more worried that if it's taking a long time just to do the redirect, that could be symptomatic of an overall issue which was slowing all requests.

    I just checked a static site on the same server, and the redirect TTFB was under 70 ms, so I don't think it's a server issue.

    I think the problem is that it's searching a gazillion subdirectories for additional .htaccess files. Ideally I'd move the htaccess stuff to the virtual hosts file and AllowOverride none, but unfortunately that's not an option, so I guess I'm stuck with it. But at least I know what's causing it.


Advertisement