Rewrite/redirect from one dynamic page to another.

URL rewriting always stumps me. I never remember the details and have to rely on search or looking at old .htaccess files I’ve done before to get what I need for a new project. I’m not sure it’ll ever be something I’ll “master” (in that I can write the code and not need to search for examples).

ANYWAY, the last time I was stumped was where I needed to redirect requests from /faculty/bio.php?id=45 to /people/bio.php?id=45. Seems simple enough. The problem is that regular redirects don’t work for items in the query string so something like this won’t work:

Redirect /faculty/bio.php?id=45 http://site.com/people/bio.php?id=45

Instead I needed to use a Rewrite instead of a Redirect which are far more complicated. I found a few great resources but I couldn’t get it to work. I decided that instead copy/paste I would type out what I read so that maybe I could master the syntax.

Anyway, here is what I came up with:

RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^faculty/bio.php$ /people/bio.php?id=$1 [R=301,L]

Long story short that was ALL WRONG. Because of one reason. The problem was that I kept using $1 instead of %1. $1 is matches on the first RewiteRule pattern (of which I didn’t have any) and %1 matches to the first RewriteCond pattern (the pattern in parentheses or course).

Another problem was I kept trying this:

RewriteRule ^/faculty/bio.php$ /people/bio.php?id=$1 [R=301,L]

The problem with that rule is the slash at the beginning of the url match (plus the $1 instead of %1 . . . it’s always compounding errors that take the longest to fix). The “match” in the rule always starts from the current folder and you can’t tell it to start at the root from some other folder (which makes sense . . . imagine I had a /stuff folder and it it was some redirect rule that matched on /faculty . . . that would NEVER match since you are already in the /stuff folder).

Anyway, a few tough lessons I’ll probably forget soon. Maybe writing it out here will help with my memory issues.

Sheldon

Tekpub Value

I’m a big fan of Rob Conery. I like his honesty. I like that he’s a “rabble rouser” (I was going to link to a controversial post but there are so many!). And since Scott Hansleman considers him a friend I know he’s a good guy.

Two years ago I won a free year of Tekpub by answering a trivia question of Rob’s on twitter. It came at a GREAT time since I was recently out of work and trying to learn as much as I could. By the time my year had expired I had a new job and I didn’t think twice about handing over $200 during the two for one promotion in December.

Now it’s a year later and I blew $1000 on black Friday (mostly for a new TV . . our first flat screen!) and another $200 a few days later on a Lego train (which, so far, gave me way more joy than the TV . . it’s awesome!).

Needless to say I gotta watch the budget. Do I really want to spend the $200 for Tekpub this year? If I were to purchase every production from 2011 independently, here is how it would break down:

Mmmm, $171 . . . over the course of a year. Way less than I thought. This is an easy decision. For 2012 I’ll buy the ones I really want to see and save that $200 for another Lego set.

Sheldon

Taking half

Got this in an email from “Republican John” and this was my response.

====

What about taking half and giving it to disabled kids? Or taking half and using it as payment for cleaning the sidewalks? Or taking half and giving it to kids in neighborhoods where everyone is poor and hardly anyone hands out candy?

It’s probably all a hoax.

I wish I could give credit to someone for this but I got it in a random email. Mmm, maybe I’ll try Google Image search.

Sheldon

The infrasturcture is great . . . . except for this one thing.

I have almost nothing to complain about the IT infrastructure at ASU. Wireless works great (there are TWO wireless networks to jump on, the guest one and the one and the official one that works as if you are wired in . . no VPN needed). The servers we use are rarely down. There are wiki solutions and hosting solutions provided by UTO (instead of the “IT department” it’s the University Technology Office) for faculty and staff (and students but I’m staff). my.asu.edu the “portal to everything” (including payroll, hr, help desk as well access to class schedules, grades and other student info) is slow at times and kinda clunky but it works and it’s a big job so I get that it can’t be perfect and I’m happy with how much of my info I can manage online (seems like everything related to data at ASU is done online except for things where you need a signature). I can go on and on about the good and great but this is youfailed.us not youwin.us.

I’ll sum up my problems with a help ticket I’m about to submit.

=============

I like ASU gmail. I want all my ASU email to go to gmail. But since I need Outlook for testing html email I’ve kept it around and pop’d my messages from there to ASU gmail.

This presents 2 issues: a) in the GAL (global addressbook in Outlook) my email address is sheldon@mainex1.asu.edu and that’s the address other Outlook users (including my boss) see, and b) ASU Gmail will only pop exchange about once an hour and that’s not enough (which isn’t something UTO decides . . it’s a limitation of gmail itself and there to protect resources).

Since I can’t (and UTO won’t) change the GAL to my real address without deleting my exchange account I would like to delete my exchange account. I know I would loose access to public folders and the calendar but I don’t use the calendar and we’ll figure out a new way to handle the public folders email that I need to see.

Sheldon