urlencode question
Posted: Wed Mar 11, 2009 1:58 pm
I'm in the last stages of a site but I'm having one annoying problem. I'm trying to create urls for a news page which look a little nicer, using the title as part of the url (versus an id tag). I'm trying to use urlencode() to get the title in the right format for being used as part of the url, however, it does not encode non-alphanumeric characters, like a question mark. So if the title is 'Click Here?' url encode makes it 'Click+Here?'. When clicking on this link, the browser automatically converts the '?' to %3F. Using $_GET however, this %3F is lost, which then means it can't find the entry.
I'm also using mod rewrite in a .htaccess file, which I suspect may be another possible culprit. Here's the line that is handling this particular request (my first shot at using mod rewrite):
It seems to work fine so long as a character isn't an 'irregular' one (like ?, #, etc).
If you need to check it out, the site is located at http://stmc.bc.ca/test/. The 'Current' is the problem (try the top entry). The page outputs the $_GET["news"] (where news is $2 in the .htaccess) at the top...
Thanks!
I'm also using mod rewrite in a .htaccess file, which I suspect may be another possible culprit. Here's the line that is handling this particular request (my first shot at using mod rewrite):
Code: Select all
RewriteRule ^(academic|drama|green|music|newspaper|newsletter|sports|studentcouncil|youthministry|parents|alumni)/([^/\.]+)/(.*) /test/department.php?department=$1&$2=$3
If you need to check it out, the site is located at http://stmc.bc.ca/test/. The 'Current' is the problem (try the top entry). The page outputs the $_GET["news"] (where news is $2 in the .htaccess) at the top...
Thanks!