Jump to content
tarquino

url question

Recommended Posts

i am trying to understand, how a site like ebay can display content and be case insensitive?
for example:
 

The original url:

http://www.ebay.co.uk/itm/Toshiba-Satellite-C50-AMD-E-Series-1-4GHz-Dual-Core-15-6-Inch-500GB-2GB-Laptop/151458954958

the above works fine and go to the intended page.

user editing the browser url into lowercase :

http://www.ebay.co.uk/itm/toshiba-satellite-c50-amd-e-series-1-4ghz-dual-core-15-6-inch-500gb-2GB-laptop/151458954958

random uppercase and lowercase.

http://www.ebay.co.uk/itm/toshiba-sateLLite-c50-aMd-e-sERIes-1-4ghz-dual-core-15-6-inch-500gb-2GB-laptop/151458954958

both the urls above also work fine and go to the intended page.

 

How can such a thing can work? it is supposed to throw an error such as page not found and the like?

any thoughts welcome.

Share this post


Link to post
Share on other sites

It will do whatever it wants to do. Apparently eBay doesn't care about case-sensitivity, and I bet it doesn't care about the label at all - just the number at the end.

Share this post


Link to post
Share on other sites

Everything in a url is case sensitive, browsers will lower the domains though.

So if is a path/folder/file should always do them proper case.

 

What you see there is not a real location but added into the url for seo purposes, as requinix said they probably just use the id.

 

Could be a fancy rewrite rule and the url could look something like this

http://www.ebay.co.uk/?itm=toshiba-satellite-c50-amd-e-series-1-4ghz-dual-core-15-6-inch-500gb-2GB-laptop&id=151458954958

The parameters would be able to be uppercased for display and lowercased for usage.

 

Edit:

Yes this works the same

http://www.ebay.co.uk/itm/151458954958

Edited by QuickOldCar

Share this post


Link to post
Share on other sites

how do they manage to do so? do they use htaccess redirects and the like? or is this down to something else?

Share this post


Link to post
Share on other sites

They use URL rewriting. Exactly how depends on the servers they use in the background: Apache or IIS or nginx or whatever.

Share this post


Link to post
Share on other sites

It's all in .htaccess where the URL rewriting is coded. You can do anything in the .htaccess, such as changing all the characters in the URL to lower case before attempting to do the matching and rewriting.

Share this post


Link to post
Share on other sites

It's also possible they just store their urls as lower case strings in the db and force the requested URL to lowercase to get a match?

Share this post


Link to post
Share on other sites

But I believe Requinix is correct and they are going by the ID at the end.

http://www.ebay.co.uk/itm/some-crap-here/151458954958

loads the same content as the original.

http://www.ebay.co.uk/itm/Toshiba-Satellite-C50-AMD-E-Series-1-4GHz-Dual-Core-15-6-Inch-500GB-2GB-Laptop/151458954958
Edited by CroNiX

Share this post


Link to post
Share on other sites

People create uppercase or mix case URLs mainly for branding or SEO purpose.Sometimes they  do this for better readability.Generally it should throw exceptions while user request with URLs not matching the case. But this is avoided by adding some rules in either in .htaccess file or using RewriteMap in httpd.conf^.Second one is less complex and works faster.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.