Reputation: 7732
I have a website with a database of part numbers. My manager wants to be able to type:
www.site.com/products/part#
and have thepage automatically take you to the relevant page.
Right now I have it take the URL and mod-rewrite the page to:
www.site.com/search.php?sku=xxxx
And a php srcript will $_GET the sku and do the search, problem is, some part numbers have # and / symbols in them, eg:
www.site.com/products/VS816UT#ABA
I can get around any slashes with mod-rewrite, but the browsers strips the # symbol before the $_GET can see it.
Is there a way around that?
Upvotes: 0
Views: 173
Reputation: 231
There should be no trouble doing it, but what you want is a handler for /products/ that gets the trailing part of the url (frameworks like codeigniter are good at that).
You need a single page handler that dispatches based on as much (or as little) of the url as you need.
Unfortunately, at least some browsers strip the # and everything after it. I did a test using a url with a# and monitored what the browser sent with tcpdump and got this:
Url:
http://127.0.0.1/onepage/products/zss#www?b=A#B
tcpdump o/p:
GET /onepage/products/zss
Presumably, server-to-server is the only way this can work.
Upvotes: 0
Reputation: 298106
Anything past the hash (the #
) isn't sent to the webserver.
If you want to get around this, why not append the #ABA
with a slash:
www.site.com/products/VS816UT/ABA
And use mod_rewrite
to properly map it to your PHP file.
Upvotes: 3
Reputation:
the # symbol is reserved for anchor tags inside browsers, in accordance with web standards.
Upvotes: 1