Mixing Pretty and Ugly URLs

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
calrockx
Forum Newbie
Posts: 6
Joined: Mon Apr 28, 2008 11:32 am

Mixing Pretty and Ugly URLs

Post by calrockx »

alrighty, got a bit of regex stuff i'm stumped on...

i've got pretty urls working on my site to get something like http://charlesrubinoff.com/work/?type=print&Id=yota_mag to display as http://charlesrubinoff.com/work/print/yota_mag. that works beautifully.

the .htaccess regex i'm using is:

RewriteEngine ON
RewriteRule /?work/([^/]+)/([^/]+)$ /work/index.php?type=$1&Id=$2 [L]



the problem now is adding in one more variable.

once on, say, http://charlesrubinoff.com/work/print/yota_mag there are three or so thumbnails for different images of that project. with ugly urls, that extra variable would be shown as http://charlesrubinoff.com/work/?type=p ... ag&shot=90

i don't want to make that extra bit added on as pretty style (not like http://charlesrubinoff.com/work/print/yota_mag/90), instead i want to add it "ugly" style to the end of the pretty url, so i'd want it formatted like


http://charlesrubinoff.com/work/print/yota_mag?shot=90

is this possible? the project would have to initially load without that shot info (work/print/yota_mag), but then if the user clicks another image, it'd be added to the url. i tried messing around with the regex to make this happen, but aye, no luck.
Post Reply