[thelist] SEO and dynamic URL's

Joshua Olson joshua at waetech.com
Thu Jul 8 20:05:12 CDT 2004


> -----Original Message-----
> From: Michael Dinowitz
> Sent: Thursday, July 08, 2004 6:51 PM

> I prefer to do it within CF rather than within the webserver due to my
> bias. I believe that doing it within the webserver would basically
> mean that the url that's being called is captured and redirected
> rather than being gone to directly. Also, I just think it's kind of
> ugly. You have no idea what's being passed, why, where, what it means,
> etc. What happens when your looking for a file 3 directories down
> rather than 2. How does the url rewriter know where the url stops and
> the variables begin.

Michael,

I understand what you mean regarding CF.  But, some of your other statements
are not entirely accurate.  For example, you said :

"I believe that doing it within the webserver would basically
mean that the url that's being called is captured and redirected
rather than being gone to directly."

That is not accurate.  When doing URL rewrites, there is no redirection.
Instead, the URL is being rewritten before it's even being handed to the web
server.  For example, you could rewrite the following:

http://www.houseoffusion.com/cf_lists/message/4/33724/

Into:

http://www.houseoffusion.com/cf_lists/message.cfm?threadid=4&messageid=33724

Or, if you choose to restructure the files, it could turn into this without
needing to change anything:

http://www.houseoffusion.com/newmessage.cfm?threadid=4&messageid=33724

By the time that IIS, or CF for that matter, sees the request, the URL is
constructed back to the standard format.  That means that form.threadid and
form.messageid are already set as you'd expect.  No directions, no CF
processing overhead, no confusion.

Because the request is being corrected before it even gets to IIS, Apache,
or whatever, it's never looking for files that don't exist or that require
changing settings in IIS to make it work.  The URL is clean and the hand-off
is likewise clean.

Then you asked:

"How does the url rewriter know where the url stops and the variables
begin."

That's all based on regex matching.  Typically, for example, I would make
sure the first "folder" off the root is unique, and then know that whatever
follows it are parameters.  Since it's pattern matched on regex, you can
easily specify different remappings for 1, 2, 3...n parameters.

Example, I often use this for calendar apps.  I may make five rules for the
calendar.

http://www.domain.com/calendar -> Maps to the base application (/cal.cfm)
http://www.domain.com/calendar/YYYY/ -> Maps to the calendar of the current
date in the year YYYY (/cal.cfm?year=YYYY)
http://www.domain.com/calendar/YYYY/MM/ -> Maps to the calendar for the
month of MM in year YYYY (cal.cfm?year=YYYY&month=MM)
http://www.domain.com/calendar/YYYY/MM/DD/ -> Maps to the specific day in
the calendar (/calday.cfm?year=YYYY&month=MM&day=DD)
http://www.domain.com/calendar/event/EID/ -> Maps to the specific event in
the calendar (calevent.cfm?eventid=EID)

> But bottom line is that if both work and both work well, the decision
> to use one over another is one of style.

Ok, true enough.  But, that being the case, if you haven't had the chance to
play around with URL rewriting, I suggest you consider taking a few minutes
to work with it.

ISAPI_ReWrite is a great add-on for IIS that provides functionality similar
to mod_rewrite for apache.

http://www.isapirewrite.com

One thing I really like about it is that the rewriting rules file is a text
file in the root of the website.  It can be changed at any time and changes
to it are instantly reflected without having to restart the website.  Very
convenient.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168




More information about the thelist mailing list