Forum Moderators: coopster

Message Too Old, No Replies

RewriteRule doesn't alwasy work

Please have a look - I think php is messing with input

         

leifwessman

6:32 am on Apr 20, 2004 (gmt 0)

10+ Year Member



Hi!

I have the following RewriteRule:

RewriteRule ^cat/(.*)$ cat.php?q=$1

But when accessing the following cat:

[domain.com...]

$_GET['q'] in cat.php becomes "Internet" and not "Internet & IT" as expected.

Why is that? And how can I avoid it?

Leif

mykel79

9:19 am on Apr 20, 2004 (gmt 0)

10+ Year Member



The parameters become:
q=Internet
IT=

The & sign signals the start of the next parameter. I'm not sure how to get around it though, except using a different sign than & and if necessary substituting it back for & later.

leifwessman

9:35 am on Apr 20, 2004 (gmt 0)

10+ Year Member



But it works for Amazon...

[example.com...]

Seems to me that there is something wrong in PHP or in my RewriteRule. What do you think?

[edited by: jatar_k at 3:36 pm (utc) on April 20, 2004]
[edit reason] examplified url [/edit]

panic

1:42 pm on Apr 21, 2004 (gmt 0)

10+ Year Member



If you try Internet%20and%20IT , the value is captured. However, when you try Internet%20%26%20IT, the value isn't captured. I believe this happens because ampersands are only to be used in query strings.

Also, you might want to try using underscores rather than spaces, followed by an html file extension. Internet%20%26%20IT doesn't look nearly as clean as Internet_and_IT.html