Got a question:

I'm using $_SERVER['REQUEST_URI'] to get the URL that the user used to access the page.

I've also got some mod_rewrite rules going on so the URL looks user-friendly.

Basically, the user sees the URL as:
"Products/Ultrasonics/Browse/ClassB/AG 1007"

Where the last part of the URL is actually a product name for a database. In fact, the entire URL is generated from a database based upon the user's current page.

The rule being used here is:

RewriteRule Products/BroadbandPlasma/Browse/Analog/([0-9a-zA-Z\s-]+)$ /products/productquery.php?model=$1&class=plasmabroadband [L]

The issue I'm having is that when I use $_SERVER['REQUEST_URI'] to retrieve the URL, the returned value for all products that have a space and then some number combination is returned with extra values. These values seem to be dates, so I'm not sure why the return value is being interpreted as a date. Here are some test examples:

Product Name $_SERVER['REQUEST_URI'] result


AG 03-450 AG&2003-450
AG 0313 AG%200313
AG 1012 AG%201012

All values that don't have a space in them are fine. They are properly returned as the actual product model.

Any ideas?

Thanks,

Bobby

    It's called URL encoding. You can't have a space in a URL, but you can have %20.

    See [man]urlencode/man and [man]urldecode/man.

      I should have seen that =[

      Thanks though. I appreciate it. I was having a giant headache over this matter!

        Glad I could help; don't forget to mark this thread resolved (if it is) using the link on the Thread Tools menu above.

          Write a Reply...