In this section, we will learn how to activate SEO URLs and apply to products.
Let's first browse to the product page and see how URL looks like before applying the SEO.
Notice that the default URL before SEO is parametric and this is not good for search engine crawlers.
Let's login to the administration panel and open the System | Settings menu.
We will jump to the Server tab and choose Yes for the Use SEO URLs option. Then, let's click on the Save button.
We will need to open cPanel and choose File Manager now.
Let's open the root folder of our store and choose the .htaccess.txt file there. Right-click on it and choose Rename.
We will delete the .txt prefix. Thus, we will write .htaccess for the final filename. Then, click on the Rename file button.
Let's return to the administration panel of our store and open the Catalog | Products tab.
Let's be sure that we have a nice, descriptive sentence(s) for Meta Tag Description. Most search engines take the first 160 characters of this field and show them in search engine results under the link to the page.
Let's open the Data tab. We should only change the SEO Keyword field. Notice that we have used sign between the words of the key phrase. Click on the Save button to finish.
Let's browse to the product page and see how URL was changed according to SEO.
Note
If you get an error displaying the page, you should apply the next step as well. If you see that the page is correctly shown, the SEO exercise is finished here.
Let's open the cPanel | File manager again and the Code Edit .htaccess file.
Just put a # sign in front of the RewriteBase / line. It will disable this line by commenting. Click on the Save Changes button.
An alternative option is to include path information if we have installed OpenCart on a directory rather than root. In the following example, the installation path is /store directory:
Browse to the page again. You should see that the page is correctly displayed. Open the HTML source in your browser. Notice the following SEO tags are correctly set:
What just happened?
We have learned how to activate the SEO option in settings. We then activated the .htaccess file. We have added a SEO Keyword for a product and finally checked how it looked, both in store front and in HTML source. We have learnt how to apply another change in the .htaccess file if we get an error.