4

Apache .htaccess tricks and testing the query string code

 3 years ago
source link: http://rachelbythebay.com/w/2013/04/01/edu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Apache .htaccess tricks and testing the query string code

I put up two more lessons on the "Virtual Rachel" page over the weekend.

The first one is a collection of useful things you can do with Apache .htaccess files. If you ever wanted to have a file in your document root which executed as CGI instead of having to bury it in your ScriptAlias directories (with relatively ugly URLs like "/cgi-bin/..."), it's in here. If you want to play around with denying the world and allowing some back in by hostname (or IP address), that's here too.

Finally, I did a quick demo where I rigged some rewrite magic so a hit to /abcd actually internally hits /foo?module=abcd. This is useful for minimizing ugly URLs which are too closely bound to whatever software you happen to be running today. It can also be handy if you need to change to something else without breaking your well-known URLs.

The second lesson continues the query string code from Friday. This time, I take the "all in one .cc file" situation and rearrange it into an actual class. Then I hook it up with GTest and GMock and hit it with some unit tests. It's a great way to see how a simple little blob of code can start evolving into a proper library.

There's still the matter of dealing with %nn encoding and actually storing this data in a meaningful way. Keep an eye out for future updates.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK