During christmas time a common activity is to track either your own sent packages or your receiving packages. The postal system in Norway (posten.no) provides a solution for finding the path of a package sent. One can say the system is driven by geographical attributes, however, no map is ever utilized. I found this a bit strange and during a late evening some days ago I set out on the mission to try to prototype such a solution. The solution became a system wrapping the package tracking web-site from posten.no, extracting the geographic location (postal code and place name), geocoding them on-the-fly and visualizing the information in a map with lines indicating the path. The system can be found in the sandbox; package tracking. If you don’t have a package to track you can test with this package; sm128209247no
I wonder why they don’t have a solution like this already? Fairly easy to prototype, fairly free-of-charge, easy to scale… What’s the downside? Creativity?
Everyone that has ever tried to use mod_rewrite with .htaccess files, to get a nice url or even just to redirect to a subdirectory without the user knowing it, have probably been swearing, biting, hitting and cried over; the regex, the syntax, the lack of (human-oriented) documentation and so on.
A friend of mine and I tried went through several of these phases yesterday; the goal was easy:
get http://localhost/ams/anything.php to redirect to http://localhost/ams/qsys/anything.php
With localhost being variable and offcourse http://localhost/ams to redirect to http://localhost/ams/qsys/
We tried several approaches with increasing complexity. And cried, sweared, killed apache and so on. The apache test server was installed locally on windows plattform (xampp) so the first glimpse of light was when we realized the /apache/logs/error.log and the setting for apache; LogLevel debug. This resulted in some debug information on what the .htaccess made apache do. After realizing the plain .htaccess in /ams/.htaccess, containing something like this;
RewriteRule ^(.*)$ qsys/$1 [L]
Made apache reach a recursive hell into qsys/qsys/***. But nevertheless, at the first call it did exactly what it was supposed to do. So. How to stop it. The solution, easy, probably not a silver bullett, but works;
A .htaccess in /ams/qsys/.htaccess with RewriteEngine Off
Like a deux ex machina it worked!
So, to all out there that have reach insanity over mod_rewrite and nice urls. Do it simple! Hope it works out well:)