This tutorial shows how to deal with 404 errors when SEO URLs are enabled in OpenCart 2.x.
Sometimes Opencart store returns with ‘Error 404 – Not Found’ for the inner pages. This happens due to the incorrect settings for SEO. Let’s see how to deal with that:
Make sure to have SEO URLs enabled first of all. Navigate to System> Settings > your store > Server > Use SEO URLs. Set them to ‘YES’ and save changes:
Access your server files and locate ‘.htaccess.txt’ file in the root of the Opencart installation. Rename the file to be ‘.htaccess’. Delete .txt extension:
Next, go to the site admin panel once again. Navigate to Catalog> Products> select the product> Edit> Data> SEO URL tab there. It contains the actual user-friendly link. By default, it has spaces. They can’t be actually used. Therefore update content of the tab to have no spaces. Replace them with hyphens or underscore only. Make sure that this tab contains unique combination of words, as duplicates are forbidden:
Note: the same change of SEO URL tab should be performed for each product of the store.
In case your website is installed to the subfolder (as in our case), one more change is required:
Get back to the server files once again and locate there the same .htaccess file. Open it to edit.
Find the following line there (around line #20):
where theme### is unique name of your theme:
Replace the URL reference with the name of subfolder for your store, for example:
Note: make sure to have closing slash after the subfolder name.
Save changes and reload the file.
Get back to your store and check the same product page once again. It should be opened successfully. Enabled SEO URLs don’t cause Error 404 any longer.
Feel free to check the detailed video tutorial below: