How to Enable SEO URLs in OpenCart

Enabling SEO URLs in the OpenCart admin

  1. Login to your OpenCart admin panel.
  2. Navigate to System > Settings and click the "Edit" link.
  3. On the "Server" tab, set "Use SEO URL’s" to "Yes" and save the changes.

    Enabling SEO URLs in the OpenCart settings
    Enabling SEO URLs in the OpenCart settings
  4. Connect to your server via FTP using any FTP client (e.g. FileZilla)
  5. In your main OpenCart directory, there should be a file called .htaccess.txt. Rename it to .htaccess. If you already have an .htaccess file, add this code at the end of the file:
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

6.* If your store is in a separate directory (e.g. "shop"), open the .htaccess file in a text editor and look for this line:

RewriteBase /

If your shop is installed in a directory called “shop“, for example, change the above line in the .htaccess file to:

RewriteBase /shop/

Remember to put the slash (/) at the end. Otherwise the SEO URLs will not work with OpenCart.

Adding SEO keywords for your products and categories

Note: The default OpenCart SEO URL functionality doesn't work with multi language multi shops. You'll need to install an extension for that.

Note 2: Do not use spaces in your keywords. Use only unique SEO keywords. You cannot use the same keyword for a product and a category.

To add SEO keywords for your products:

  1. Go to Catalog > Products
  2. Click "Edit" for a product
  3. On the "Data" tab fill in the SEO keyword field

    Adding SEO keyword for a product in OpenCart
    Adding SEO keyword for a product in OpenCart
  4. Go to Catalog > Categories and repeat the process for your categories

If SEO URLs don't work

  1. Contact your hosting account provider and ask them if mod_rewrite is enabled on your hosting account.
  2. Download the default OpenCart .htaccess file here

    and upload it to the main directory of your store. If your store is installed in a separate directory (e.g. shop) make sure to open this .htaccess file first and change this line RewriteBase / to RewriteBase /shop/ or whatever the name of your OpenCart directory is.

Receive a curated list of the best OpenCart tips & tricks

Delivered in your inbox weekly for free.

More OpenCart Tutorials

3 thoughts on “How to Enable SEO URLs in OpenCart”

  1. Dear Gergana,

    I have done the above exactly the way you describe. Anyway, after changing htaccess.txt to htaccess I can not longer access my backend. Do you think this has something to do with the fact that I use a multi store?

    Hopefully you can help me out!?
    Kind regards,

  2. Hi,

    That´s an awesome post. I am starting working with OC and just installed the latest version yesterday. And I believe there is a lot of things to come.

    Fabiano Viana

Leave a Reply

Your email address will not be published. Required fields are marked *