Your shopping cart is empty!
OpenCart is built initially on apache servers. This the most popular HTTP server. It is free and opensource and still holds around 50% of the market share. So if you just purchased a hosting account you are probably using apache by default.
You can setup your SEO Urls with SEO Module with a click of a button. Go to SEO Module / Dashboard and activate quick setup for SEO Urls.
Remember that this will activate SEO Urls per store. If you have multi store, you will need to switch to another store to activate the SEO urls there.
What is .htaccess and how does it work in OpenCart?
.htaccess is a configuration file that allows you to make changes to your apache server per-directory. When the file is placed in a directory, apache uses these configurations and applies them to that directory and all the subdirectories in it.
.htaccess is commonly used for these 4 tasks:
- Mod_rewrite - you can set rules to tell your server how treat the urls of your website and what content should be returned to the user. In other words you can rewrite the urls to make them user-friendly.
- Authentication - you can use .htaccess to set a username and password to access a required directory with the help of .htpasswd
- Custom Error pages - a very useful feature that helps you setup a custom error page for 400 or 500. OpenCart covers the 404 yet it is still a good idea to set a custom Error page for the rest of the server errors.
- Redirects - used to setup redirect rules. Often used when changing from http to https.
There are much more you can do with .htaccess yet these are the most popular in OpenCart with the first being the most important.
OpenCart uses this file to add SEO Urls. By default OpenCart carries a file in the root folder named .htaccess.txt with the required directives. Unless you remove the .txt extension by renaming the file, it will not take any effect on the work of your apache server.
How to activate SEO Urls in Opencart with .htaccess?
.htaccess editor allows you to modify your apache .htaccess file directly from the admin panel. To activate your SEO Urls you need to the following:
- rename .htaccess.txt to .htaccess
- go to OpenCart Store settings / tab server and activate SEO URls
If your store is located in a subfolder (ex. http://myshop.com/store/) then you are required to edit the defualt RewriteBase from RewriteBase / to RewriteBase /store/ in your .htaccess file.