title: Why is my 301 Redirect taking so long?
body: <p>In a long tiredsome quest to speed up my site, I have figured out something is wrong with the redirection: currently my index.php handles all the homepage redirections via <strong>PHP header location 301</strong> Redirect Permanently:   <em><code>website.com</code></em> >> <em><code>website.com/en/home</code></em>  and <em><code>website.de</code></em> >> <code>website.de/de/home</code> etcettera etcettera (around 20 for this multilingual website) it takes anywhere from 200ms to 6000ms to do the redirecting. Check out the waterfall!</p>
  
  <p>After that, the page loads in a thunderbolt's blink of an eye! 
  What a waste of time wouldn't you say? What is the server doing all this time?
  After careful examination, my best guesse is: <strong>ITS DOING LAUNDRY</strong>!</p>
  
  <p>I am almost giving up on PHP for this!
  Any and all clues to my puzzling prob are very welcomed +1</p>
  
  <p>A. Given facts: Apache/2.0.54 Fedora, PHP 5.2.9. there is no database: just flat php files with around 15 php includes that completes my page with headers and footers). YSlow Grade: 92/100! Good page Speed: 93/100! javascript and css are as much as possible combined. Cache controlls seem well set too (as proven by the grades). Whats missing in those 7 points out of 100: not using Keep-Alive (beyong my controll in shared hosting and not using Content Delivery Network. I can live with those missing 7 points, but this is major hit on speed!</p>
  
  <p>B. Furthermore: i recently was given great insights over here that i should use url rewriting via htacces. Point taken, BUT, perhaps there is sometin <em>else</em> wrong here that i should correct before moving on to the for me more difficult apache regex syntaxes.</p>
  
  <p>C. Faster way: When I php <code>include</code> the intended homepage, instead of redirect, then all loads fast, but the url is not rewritten: it sits at website.com on the browser bar, whereas i wish after including it to become website.com/en/home. Is this possible with PHP? To include+change the current address of the url, too?</p>
  
  <p><a href="https://i.stack.imgur.com/2cKmb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2cKmb.png" alt="screenshot"></a></p>
  
  <p>Conclusions: you can redirect using index.php, or using .htaccess. Sofar from my tests (coming from the genius answers below!THANKS EVERYONE!) the latter seems unmatched in speed: much faster redirecting than a php redirect! reducing the redirect to shorter than the first dns lookup.</p>
  
  <p><strong><a href="https://serverfault.com/questions/214211/compact-redirects-in-apache-htaccess-how-an-elegant-coding-question/214215#214215">see here how to do this correclty for multilingual site</a></strong> </p>