Opencart 后台开启SEO功能后,前台出现页面404错误如何解决?
特别注意的是,如果你的opencart 不是安装在网站根目录,那么就一定会碰到这个问题。留意下面教程的第四步!
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):
RewriteBase /BRB/theme###/
where theme### is unique name of your theme:
- Replace the URL reference with the name of subfolder for your store, for example:
RewriteBase /opencart/
Note: make sure to have closing slash after the subfolder name.
- Save changes and reload the file.