Smart URLs
| From: | Scott 'INtense!' Reismanis | Date: | Mon, 03 Jun 2002 04:28:27 +0000 |
| Subject: | Smart URLs | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-100305@lists.php.net to get a copy of this message | ||
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
scott@moddb.com
http://www.moddb.com/ - "Every Game,
Every Mod, One
Site... Go Figure!"