How to Fix SEO URLs Giving 404 Errors in OpenCart?

OpenCart allows the use of search engine optimized URLs for product, category, manufacturer and information pages. SEO keywords are defined per product, category, manufacturer and information page, stored in a database table (url_alias), looked up at each page request, and translated into an internal URL. Opencart store returns with ‘Error 404 – Not Found’ for the inner pages. This happens due to the incorrect settings for SEO.

 Fix SEO URLs Giving 404 Errors in OpenCart

  1. 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.
  2. 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.
  3. Fill in the SEO Keyword for all the Categories and Products.Go to Catalog > Products > Data > Seo Keyword. Take note of the following-
    1. SEO Keyword is unique, and no duplicates are allowed.
    2. There should be no spaces in your SEO Keyword. You should use an underscore or hyphen between each word.
  4. Update : In case your website is installed to the subfolder  e.g. http://www.yourdomain.com/opencart/, you’ll need to modify the .htaccess file located in your OpenCart folder.
    1. Edit the .htaccess file, and look for the following code section, starting from line 18:
      # SEO URL Settings
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]​
    2. You’ll need to edit line 20, which is:
      RewriteBase /
      to
      RewriteBase /opencart/
    3. After editing, your code should look like this:
      # SEO URL Settings
      RewriteEngine On
      RewriteBase /opencart/
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
    4. Save changes and reload the file.

If you face any problems or need our professional services, please email us at [email protected].

 

Join our Newsletter

Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.