First off, I must give credit where it is due. I got most of my information on OpenCart Clean URL’s from PHP Genious. In this post I will explain how friendly or clean URL’s work in OpenCart.
Clean URL’s are built into OpenCart 1.5. To use SEO URL’s you need to enable them under your stores server settings, rename the .htaccess.txt file and add your SEO keyword for each product and category you create. The keywords will not be created for you. You must also have Apache mod_rewrite turned on. Most web hosts will have this on by default.
Enable SEO URL’s in the OpenCart Admin
The first step is to enable SEO URL’s in your stores admin. Go to the “System” drop-down and click on “Settings”. Locate the store you want to alter and click the “Edit” link off to the right. Finally click the “Server” tab and set the SEO URL’s radio to “Yes” and save your settings.
Rename the .htaccess.txt file
Next you must create an .htaccess file. If you do not create this file your pages will not display. OpenCart provides a file called .htaccess.txt. Rename this file to .htaccess and you will be good to go. If you don’t have this file in your root directory you will need to make your own .htaccess file. The fiel should include the following:
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
Order deny,allow
Deny from all
# 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
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M
# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M
# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200
# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200Enter SEO Keywords for URL’s
Finally, you need to enter SEO keywords for every page, information, product and category you want to have URL rewrite. You can find the field for the SEO Keywords under the Data tab when editing and creating items.
Once you have entered the SEO Keywords your URL’w will be working. Now go and enjoy more traffic and happy customers.



Thank you for these clear instructions. Interestingly, if you use an SEO keyword for the product only, you get a nice short URL that just has the product name after the root domain (like a WordPress post). But if you add an SEO keyword for the category, the category’s URL will be shortened and the product URL will contain both the category and the product name. Either way, this is a huge improvement on the standard set-up, and a step that a huge number of e-commerce sites seem to miss.
This is a very slick feature of opencart that can enhance your sites visibility. One thing to watch out for is creating too many category sub levels as each will add to the SEO string. I also recommend that (before going live) you really nail down what the names of your categories and products will be. If you end up making a lot of changes it will take forever for google to update, leaving you with a lot of 404 errors.
Thank you so much for this. Your instructions are very clear and easy to follow.
I didn’t have a .htaccess file and I received a 403 forbidden error after creating one. I figured the ‘Prevent direct access to files’ make all the php files inaccessible. I changed it to following to get it working.
# Prevent Direct Access to filesOrder deny,allow
Allow from all
I understand what I have done could be a security risk. Is there any other way to prevent direct access to files? Thanks in Advance.
I have tried this method and it didnt work. how do I enable mod_rewrite on my server. Am using MAC
You may need to do a bit of googling. I tried to find something for you myself but I dont really know what version of apache or mac you are using.
I tried this method but on my browser “Internal Server Error”.
can you help me please
Be sure you have apache mod rewrite installed and + FollowSymLinks on for the Directory you are working with. See http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html and http://httpd.apache.org/docs/2.0/mod/core.html#options sadly I can not help you out side of these two things. The fix wil be dependent on the technologies you have running and that can vary.
Thank you it’s working
Your instructions were pretty good till you got the the paragraph about renaming your htaccess file.
Why does all that text need to be in the file ?
Some if just seems to be comments.
The text I have in the post is the original file. this is why there are comments. If you already have .htaccess I would worry about it.
I am using Arvixe for a hosting solution. I have implemented both your instructions and other instructions that I found at opencart.com. and I have implemented the rewrite module and have vast experience with Apache and many linux distros on my own physical boxes with no problems. However, with Arvixe it works for a few days, and then BAM! sites stop working.
So I thought, “ok you didn’t clear you cache and it never worked in the first place.” Tried again, worked for a couple of days and revisited the sites with different VMs etc. and then a couple days go by, and BAM ‘page not available.’
There are no errors in the logs to even give me an idea of where to start and I don’t have access to the /var/log/apache2/*
Thoughts? Ideas? Suggestions?
Sounds like you may be having DNS issues. I would recommend contacting your provider and asking about down time. This seems very odd.
The tutorial is great but I try to add the selection keywords and it gave me a 500 and error. Please help hx.
If you are using Apache be sure you have mod rewrite on.
Ok, found the issue. Multiple SEO keywords put in by the customer for every product. Nothing was unique…..