You can do this with just PHP, but I think php must be installed as a
module.
Basically place a file called thumbnails.php in your site route, then
whenever a URL like
mysite.com/thumbnails/funny/4
i called the thumbnails.php is excuted, in which you chop up the URL, and
find all your varibles...

Here is a example of some URL chopping (some code I stole from my source)
/*
Sample URLs:
/s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
/s/1/0/SchoolName/    -Shows Students At School (with school ID 1)
/s/1/2/       -would work as well (name in URL for search engines)
/s/1/0/       -would work as well
/s/        -Shows Schools
*/

$url_array=explode("/",$REQUEST_URI);  //BREAK UP THE URL PATH
                       //    USING '/' as delimiter
if ($url_array[1] == 's')
 {
 if (isSet($url_array[2]))
  $url_sID=$url_array[2];      //School ID
 if (isSet($url_array[3]))
  $url_stID=$url_array[3];        //Student ID
 if (isSet($url_array[4]))
  $url_sName=$url_array[4];          //School Name (not used)
 if (isSet($url_array[5]))
  $url_stName=$url_array[5];    //Student Name (not used)
 }
/*

There was a article on phpbuilder.com that explains the benefits and
pitfalls of this idea... Here is the URL:
http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was a
follow up article as well

Enjoy
Andrew

----- Original Message -----
From: "Scott 'INtense!' Reismanis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 5:28 AM
Subject: [PHP] Smart URLs


> Hey all,
>
> I was recently trying my luck at dabbling in some mod_rewrite
> stuff, and I have run into numerious errors. Basically my aim is to
> re-write my sites URLs so instead of being say,
> mysite.com/thumbnails?type=funny&gallery=4 the URL is neat, similar to
> many sites who would have something like mysite.com/thumbnails/funny/4
>
> What ways are there of achieving this (excluding, redirecting the URL
> and creating the page say index.htm automatically)? I have tried
> mod_rewrite for two days solid to no avail. I am not sure if it is my
> poor coding or the fact that I am running apache2 on a Windows platform
> which are said not to support such a module well. If any alternatives
> could be proposed or even better someone could suggest a mod_rewrite
> routine which would transparently transform any url like
> mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
> appreciated. So far the rewrite you see below will work with
> mysite.com/whatever/ however the minute you add something onto the end
> i.e. mysite.com/whatever/4/ it will raise the error "Premature end of
> script headers: php.exe", instead of loading whatever.php as intended.
>
> RewriteEngine On
> Options +FollowSymlinks
> RewriteBase /
> RewriteRule ^/(.+)/(.+) $1.php [L]
>
> Thanks for your time and hopefully someone understands what I am trying
> to say :), and as always any suggestions at all would be awesome!
>
>             Regards,
>
>
>                    Scott 'INtense!' Reismanis
>                    Mod Database System Administrator
>                    [EMAIL PROTECTED]
>                    http://www.moddb.com/ - "Every Game, Every Mod, One
> Site... Go Figure!"
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to