Tonight I finished "Revelation Space" and found it more than worthy of it's rating of 4/5. Whilst stacking it with my other paperbacks (I really, really need to buy a bookshelf) I couldn't resist a quick count. I now have bought and read 46 since I arrived over here, a rate of two-thirds of a novel a week.
This weekend I think it's time to geek it up and get reading the Mason book and The Pragmatic Programmer.
It's interesting to read Jeremy Zawodny's take on URLs. I would like more people to apply the KISS principle (Keep It Simple, Stupid) to them. It makes sense. I found this great mod_rewrite tutorial courtesy of inluminent.
You could do fancier things with this. I think some one already patented using a subdomain as a session ID though. Nice way to keep an ID with a session without having to re-write any links.# catch foo subdomain requests (or even subdomains of foo)
RewriteCond %{HTTP_HOST} ^foo\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} \.foo\.example\.com$
# which are not requests for the following specific documents
# (which we would rather have pulled from their normal paths
RewriteCond %{REQUEST_URI} !^/robots.txt
RewriteCond %{REQUEST_URI} !^/favicon.ico
# and which don't already point to things in the foo directory
RewriteCond %{REQUEST_URI} !^/foo/
# and re-write them to point to things in the foo directory
RewriteRule ^(.*) http://%{HTTP_HOST}/foo/$1
# for added consistancy, so our resources don't end up with
# two URLs (ie: foo.example.com/foo/x and example.com/foo/x)
# catch requests which aren't in the foo subdomain
RewriteCond %{HTTP_HOST} !^foo\.example\.com$
RewriteCond %{HTTP_HOST} !\.foo\.example\.com$
# but which point to the foo subdirectory
RewriteCond %{REQUEST_URI} ^/foo/
# and force them to the foo subdomain
RewriteRule ^(.*) http://foo.example.com/$1
Re:mod_rewrite
ThatAdamGuy on 2003-02-28T05:52:58
Hi there,
I must first admit that while I'm proudly at least somewhat of a geek, I'm a perl-idiot. I know enough to upload my perl cgi scripts with the right permission, and that's about it. And as far as.htaccess... well, um, I know about basic redirects :D
That said, I humbly ask for your kind help.
I run the site smilezone.com, and I just started up a blog at blog.smilezone.com. Everything's been relatively hunky dory since I discovered and implemented this in my.htaccess file to get the subdomain to work:
---
RewriteEngine On
Options +FollowSymlinks
RewriteBase/
RewriteCond %{HTTP_HOST} blog.smilezone.com
RewriteCond %{REQUEST_URI} !blog/
RewriteRule ^(.*)$ blog/$1 [L]
---
This works fine, except for two problems:
1) It doesn't protect against people accessing my blog incorrectly via smilezone.com/blog
2) If someone goes to blog.smilezone.com/tips (without the trailing slash), they're transported to www.smilezone.com/blog/tips/:-(
So this evening, I stumbled upon your.htaccess snippet above, Matt, and tried it out. It seems to work great, except for a DIFFERENT problem:
It redirects blog.smilezone.com to blog.smilezone.com/blog/, when I don't want the last blog there.
Thanks so much in advance for any advice you can offer:-)
Regards,
Adam