Seymour Clufley
12-08-2008, 10:01 AM
I'm building a website which catalogues a number of products. Each product has a unique code.
Just now, this is how I'm doing it:
http://www.mywebsite.com/generic.html#pr=productcode
"generic.html" is a page containing only the stuff universal to every product - the page structure, the necessary JS files, the link to a CSS file, etc... When the page loads, a JS function called "InitialiseStateFromURL" is called. It gets the window.location, extracts the product code and requests the information for the product using AJAX. The various elements in the generic page then get filled with the product's information.
However, I'd like the URLs to be even simpler, like this:
http://www.mywebsite.com/productcode
The trouble is that doesn't point to a webpage file. It points to a non-existent folder. Now, for every product, I could create a folder with an htaccess file redirecting to a URL of the form mentioned at the start... but I suspect there's a better way to do it.
Can anyone tell me?
Thanks,
Seymour.
Just now, this is how I'm doing it:
http://www.mywebsite.com/generic.html#pr=productcode
"generic.html" is a page containing only the stuff universal to every product - the page structure, the necessary JS files, the link to a CSS file, etc... When the page loads, a JS function called "InitialiseStateFromURL" is called. It gets the window.location, extracts the product code and requests the information for the product using AJAX. The various elements in the generic page then get filled with the product's information.
However, I'd like the URLs to be even simpler, like this:
http://www.mywebsite.com/productcode
The trouble is that doesn't point to a webpage file. It points to a non-existent folder. Now, for every product, I could create a folder with an htaccess file redirecting to a URL of the form mentioned at the start... but I suspect there's a better way to do it.
Can anyone tell me?
Thanks,
Seymour.