Solved: SEO URLs not working in OpenCart

If you’re using OpenCart as a E-commerce CMS for your web-store you might come across a setting where you can enable SEO URL in the System Settings location.

Once you enable SEO URL, you magically expect it to work on OpenCart right? Wrong, you need to configure your HTACCESS file in-order for it to work.

htaccess-opencart-seo-url-solve

Basically htaccess files are used to alter URLs for redirections etc.

1. All you got to do for SEO URL to work on OpenCart is rename your htaccess.txt file to .htaccess in your home directory where you website is located.

You may use CPanel File-manager or an FTP Client to connect to your server and do the changes.

In my case, I couldn’t even find the htaccess.txt file on my Server at all, so I took it off the OpenCart installation  here is the generic file you can download and upload to your Server can rename it htaccess.

2. Add SEO Keywords for your Products and Categories

Go to Catalog » Products » Data » Seo Keyword. Do 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, I would recommend an hyphen.

3. Reload your website and SEO URLs should start working.

Incase you have your website on a Sub Directory you have to modify the htaccess to work, here’s how

Start editing from line 18:

# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

You’ll need to edit line 20, which is:

RewriteBase /

to

RewriteBase /opencart/

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]

voila!

Any trouble, feel free to email me

The DNetWorks Team