glenelkins Posted July 2, 2010 Share Posted July 2, 2010 is there a way to do this? like a url like /category/Computer & Electronics/ If i parse this the variable only shows Computer (which makes sense!) , I tried replacing & with + and then back again but when I send Computer+Electronics the + is stripped as a white space... Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 2, 2010 Share Posted July 2, 2010 & %26 Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted July 2, 2010 Share Posted July 2, 2010 Yes, an you should be using urlencode() on text that you put in the URL. This will do that for you. Quote Link to comment Share on other sites More sharing options...
glenelkins Posted July 3, 2010 Author Share Posted July 3, 2010 even with urlencode() the url for example Computer & Electronics is coming back as just "Computer" when taken from $_GET Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted July 3, 2010 Share Posted July 3, 2010 even with urlencode() the url for example Computer & Electronics is coming back as just "Computer" when taken from $_GET Must be something else in your code. With this: echo '<a href="?test=' . urlencode('Computer & Electronics') . '">Click</a>'; echo $_GET['test']; I get this as the URL: /test.php?test=Computer+%26+Electronics and this from the echo: Computer & Electronics Quote Link to comment Share on other sites More sharing options...
glenelkins Posted July 4, 2010 Author Share Posted July 4, 2010 I think its something to do with the htaccess. If i access the url: index.php?route=advertiser/category/computer+%26+electronics .... then echo $_GET['route'] shows advertiser/category/computer+%26+electronics If I use the rewrite urls like: /computer+%26%+electronics ... then echo $_GET['route'] shows advertiser/category/computer this is the rewrite: RewriteRule ^(.*)/$ index.php?route=advertiser/category/$1/ [L] Quote Link to comment Share on other sites More sharing options...
glenelkins Posted July 4, 2010 Author Share Posted July 4, 2010 quote: "Apache's mod_rewrite and mod_proxy are unable to handle urlencoded URLs properly - http://issues.apache.org/bugzilla/show_bug.cgi?id=34602" The most simple solution is to use urlencode twice! echo urlencode(urlencode($var)); Apache's mod_rewrite will handle it like a normal string using urlencode once. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.