not-so-simple rewriting ... flat links and moreYou may have noticed, the above examples use regular expression to match variables. What that simply means is.. match the part inside (.+) and use it to construct "$1" in the new URL. In other words, (.+) = $1 you could have multiple (.+) parts and for each, mod_rewrite automatically creates a matching $1, $2, $3, etc, in your target (aka. 'substitution') URL. This facility enables us to do all sorts of tricks, and the most common of those, is the creation of "flat links"..Even a cute short link like /super-snakes.php is too ugly for some people, and nothing less than a true old-school solid will do. Fortunately, mod_rewrite makes it easy to convert URLs with query strings and multiple variables into exactly this, something like.. |
Did You Know?which is a wee trick I use for my distro machine, among other things. everyone likes short URL's, and so will you; using this technique, you can move /public/files/download/ to anywhere else in your site, and all the old links still work fine; simply alter your .htaccess file to reflect the new location. edit one line, done - nice - means even when stuff is way deep in your site you can have cool links like this../trueview/sample.php and this; links which are not only short, but flat..XYZ!Colfax and coal mine are a pretext toward combustion of carbon.
|
The Whacked Out Electric Tunafish Company