- How to enable clean URLs on the “shop.html” page in the web root directory
- How to enable clean URLs on the site home page
- How to enable clean URLs if you don't have access to .htaccess file
How to enable clean URLs on the "shop.html" page in the web root directory
Let’s say you added your store to the “shop.html” file on your server and it’s available on your site via "example.com/shop.html" URL.
You now want to enable clean URLs on that page so that the store pages URLs will look like this:
- example.com/shop/My-Product-p123
- example.com/shop/My-Category-c123
Assuming your site structure looks like this:
You’ll enable clean URLs in two steps:
- Map all “shop/something” pages to shop.html in the .htaccess file:
- Turn on clean URLs in your store integration code in the shop.html file:
That's it. Now open your store, navigate to any product page and refresh the page in your browser. Both navigation and page opening after refresh should work fine and you should see the new clean URLs enabled.
How to enable clean URLs on the site home page
Let’s say you added your store to the “index.html” file on your server and it’s available on your site home page, e.g. “example.com” URL.
You now want to enable clean URLs on that page so that your store pages URLs will look like this:
- example.com/My-Product-p123
- example.com/My-Category-c123
At the same time, you want to keep the other pages of your site to open at their current URLs, e.g.
- example.com/some_other_page.html
Assuming your site structure looks like this:
You’ll do that in two steps:
- Map store pages to index.html in the .htaccess file (notice how we specify only Online store pages here to avoid the other site pages to be redirected):
- Turn on clean URLs in your store integration code in the shop.html file:
How to enable clean URLs if you don't have access to .htaccess file
If the sitebuiler you use doesn't allow you to rewrite your site URLs on the server or you cannot access .htaccess file on your hosting, than it won't be possible to enable the clean URLs schema described above. There is a workaround though — query-based clean URLs which look like the true clean URLs except for they start with '?store-page='. They are less effective than the true clean URLs but they are still better for SEO than the regular hash URLs with '#!' in them.
The query-based clean URLs will look like this:
- example.com/shop?store-page=My-Product-p123
- example.com/shop?store-page=My-Category-c123
It's easy to enable query-based clean URLs on your site. The only thing you will need to do that is to adjust your store integration code in your store page code:
If you can add URL rewrites on your server by manually changing .htaccess file or with the help of your hosting/sitebuilder support, we'd recommed using the true clean URLs instead of the query-based schema as in the examples 1 and 2 above.