Forum Moderators: phranque

Message Too Old, No Replies

Weird bug: Rewrite rule does not append period to the end of URL

period does not get added to new URL

         

renwoshin

2:03 am on Aug 28, 2006 (gmt 0)

10+ Year Member



Hi everyone,

I just learned this stuff yesterday, so I don't know if this is a bug or not.

RewriteRule ^profile/(.+)/$ profile.php?username=$1

Now most usernames have a '.' at the end of their username (don't ask me why, it's an API i'm using), when i call $_GET['username'] in the PHP script, it doesn't get the period.

In other words, if what's typed into the address bar is:
/profile/Ifawej./

It essentially is redirected to /profile.php?username=Ifawej
(without the period)

Is there a fix for this?

Thanks.

jdMorgan

3:59 am on Aug 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's probably Apache that is stripping the period, because no filetype follows that period.

Despite what we may want, we are not free to put any character any place in a URL -- The HTTP protocol has specific rules [faqs.org] about URL structure which are intended to simplify URL parsers and to make the URL path-parts unambiguous and easy to distinguish.

I'd suggest you eliminate the period as early as possible in the URL-construction process, and then add it back in the script that needs it, if that script cannot be made to work without it.

Jim