Weblogs: Web Development
All the things that have no direct relation to web standards or web accessibility
Web Development links
- The end of an era
- Social Innovation Camp projects are go!
- Usability myths and professionals
- Leaving Yahoo! again
- Isn’t it time to stop the consortium/corporation bashing when talking about web standards?
- Yahoo! UK Hack Day: 15th-16th June ‘07
- Are you as good as Dean, Stuart, Jeremy or better than Dan and Peter-Paul?
- CSS: Browser testing order
- XSS (Cross Site Scripting) Cheat Sheet
- Color Palette Generator
- Flash: Ten years, ten perspectives
- User Interface Design Principles for Web Applications
Tuesday, April 26, 2011
Gawker's geo-redirection is causing problems. Their main .com sites use hashbangs, but their country-specific ones don't. Traffic coming into the .com sites from countries with their own country-specific subdomains are redirected on the first attempt.
That geo-redirection changes the domain name, but doesn't fix the hashbang URL, so the visitor is thrown to the homepage of that domain rather than the article the link was supposed to point to.
One solution is to hand-edit the URL each time by removing the hashbang characters. The other is to go back to the originating page and click it again and hope the second time the geo-redirection doesn't kick in.
Fixing the problem
Three months without fixing this is ridiculous. And it's not difficult. So I've gone ahead and created a fix myself. Gawker are welcomed to take this code and implement it on their servers.
The solution is straightforward, the complicated part is trapping queries to the Gawker sites. It would be easier if I had control over the gawker domain namespace, but I can work around that.
Lets go step by step. The IP address of my VPS is 126.96.36.199 (this is actually my development/playground VPS).
Step 1: mapping Gawker domains to my VPS
On a Mac or Linux boxes this is a case of editing
/etc/hosts. So in a terminal running
sudo nano /etc/hosts and adding the following line:
188.8.131.52 lifehacker.com gizmodo.com
On Windows the corresponding file is
/Windows/system32/drivers/etc/hosts. Make the same edit to this file with your text editor and save. Windows users have one extra step to perform here: close down your browser and reopen. This will clear the domain name cache and allow this change to take effect.
Step 2: Click on Lifehacker links like normal
There is no step 2.
Replicating this on your own VPS or webspace
The default configuration on a Ubuntu server is to map all non-specified domain names to the default webroot (
/var/www), so all non-specified pages are served up
/var/www/index.html. So I'm using this little trick to make it easy to deal with gawker domains without any configuration. All I've done is replaced the starting
index.html with a PHP script that checks the domain name of the incoming request.
The script is as follows (running at
Fixing the web a little at a time
This solution solves my two main headaches with the Lifehacker site:
- Gawker breaking incoming links to articles
- Having to deal with that abysmal Gawker Ajax interface
I should not need to do this fix. Gawker seem to have no inclination to fix it themselves. I reiterate: hashbang URLs break the Web, here's one datapoint.
- [20/10/2009] The difference between a web developer and an engineer
- [28/07/2009] Installing CouchDB on Jeos 8.04
- [10/05/2009] Yahoo Open Hack London 2009
- [30/12/2008] PHP Frameworks: comparing CakePHP and symfony
- [28/05/2008] The value of innovation
- [19/06/2007] London Hackday: BBAuth and Yahoo Mail
- [06/02/2007] The role of a web developer
- [22/11/2006] Fixed and Fluid, myth and meme