
SEO friendly URLs in OpenCart that works
Rename or Create the .htaccess file
The opencart installation gives you a file named .htaccess.txt Rename it to .htaccess and upload to your site’s root where opencart is hosted.
It can be located in the upload folder.
Sometimes the .htaccess file is hidden by your operating system. You will have to
To see hidden files on a Mac:
http://www.mikesel.info/show-hidden-files-mac-os-x-10-7-lion/
If you cannot locate your .htacccess file, Create one.
- Open a text editor like Note pad or TextEdit
- Copy the following code OR download it as a .txt (compressed to a .zip file) here: htaccess.txt
- name the file .htaccess instead of .txt or .rtf and save it, and then upload to your server.
# 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 200
Enable the ‘Use SEO URLs’ option in your admin settings
- Go to Admin –> System Dtropdown –> Settings and click ‘edit’.
- Go to server tab and select ‘Yes’ for ‘Use SEO URLs’
Finally, Add some SEO friendly tags to your products and categories in the admin. (it’s under the ‘data tab)
Visit your store and test your page. Click here for demo
To rename the file in OSX Mountain Lion, I had to do the following:
2 finger click on the file –> Get Info –> Name & Extension section, remove .txt from the file name. Thanks for the post!
Receiving 500 Internal Server Error but have corrected it by telling my Host to Enable Mode_Rewrite.
Thanks for the tutorial
As Subash said, the SEO friendly URLs will only work for the products and categories but things like when you click on the Home button or logo to return to the homepage remain unfriendly. Therefore you need to manually fix all menu links or static pages that you have.
Clearly explained and works like that…but I wanted to use SEO friendly URLs for all menus like Home, Account, Logout, Information and other links so I worked around a little bit and got that working…if you want that you may find it here
As Gices said, SEO url only work (automatically) for products and categories. You need to manually fix all menu links or static page.