4 ms·
>If the host was www.theguardian.com, we would rewrite all the URLs on the site to be www.theguardian.com. If the Host was www.guardian.co.uk we would rewrite a
by napcae 13y ago
>If the host was www.theguardian.com, we would rewrite all the URLs on the site to be www.theguardian.com. If the Host was www.guardian.co.uk we would rewrite all the URLs on the site to be www.guardian.co.uk.
wat?
- peroo 13y agoThey couldn't change all URLs to be relative, so instead they wrote a filter which would rewrite absolute URLs to match the selected hostname. A simple fix for a relatively complex problem.
- VBprogrammer 13y agoOr a hack which will never be removed from the code-base, depending on your point of view. I'm intrigued as to why changing to relative domains wasn't possible. If nothing else pushing 'http://www.theguardian.com' http://www.theguardian.com' out for every link adds to a lot of bytes up for a busy site.
- cbr 13y agopushing 'http://www.theguardian.com' out for every link adds to a lot of bytes up for a busy site Fewer than you'd think after gzip compression: $ curl -s http://www.theguardian.com/us | wc -c 223195 $ curl -s http://www.theguardian.com/us | \ sed s'~http://www.theguardian.com~~' | wc -c 215473 $ curl -s http://www.theguardian.com/us | \ gzip | wc -c 33783 $ curl -s http://www.theguardian.com/us | \ sed s'~http://www.theguardian.com~~' | gzip | wc -c 33554 They have 7.7k of extra html due to repeating "http://www.theguardian.com" http://www.theguardian.com" for every link, but gzip compressed this is only a difference of 229 bytes.