Understanding How StoreFronts Processes URLs
It's important to understand how the StoreFront system processes a URL. First let's take a look at a URL:
http://www.mysite.com/products/test.html
If we decompose the URL into it's parts we have:
Part | Example |
---|---|
Protocol | http |
Host | www.mysite.com |
Path | /products/test.html |
UltraCart uses the host to identify which StoreFront within the system the traffic should be routed to. That is pretty simple and predictable. How does the system determine what the path maps to? The system checks a defined order of operations.
- File System
- Item Page
- Group Page
Well that was simple. Easy as 1-2-3. End of tutorial.
But wait, there is more!
File System
Within the file system system there are two places that the system will look. The first place the system looks is under the theme directly. So assuming that our active theme directory is /themes/MrTeas, then the system is actually checking first to see if the file /themes/MrTeas/products/test.html exists. If it does, then that is the file that is served up to the end user.
Next the system looks for the regular path on the file system /products/test.html to see if that exists.
Why does the theme directly get checked first? So that templates can handle paths properly for assets, images, favicon, etc. and tolerate the name changes in the theme directory as they are cloned and upgraded.
Item Page
For an item, StoreFronts separates the path into /products/ and test.html, strips off the extension, and then looks to see if there is a page with the path /products/ containing an item with the item id of test assigned to it. If so, then the item page is served up to the customer.
Group Page
Finally we check to see if the path represents a group page. So the system will treat /products/test.html and /products/test/ the same. The difference is that the StoreFront system knows to automatically render test.html as the end of the path whenever there are no additional child pages or items assigned to the group.
If you have a URL that is not loading the proper content, go into the file manager and do a quick search by the file name at the end of the page and see if a file exists within the file system. You may have accidentally created a file within the theme which is being loaded first instead of your page.