Search Engine Optimization (SEO) is a critical component of running a successful eCommerce website. OpenCart provides multiple robust features, and one of them is URL management called SEO URLs, which helps make your store's links more user-friendly and search engine-friendly. In this Opencart user manual, we will guide you through managing SEO URLs in OpenCart 4.
What are SEO URLs?
SEO URLs replace complex and unattractive query strings in web addresses with clean, readable links. For example:
- Default URL:
https://demo.webocreation.com/index.php?route=product/product&language=en-gb&product_id=43
- SEO URL:
https://demo.webocreation.com/en-gb/product/macbook
This change improves user experience and boosts your store's ranking in search engine results.
Enabling SEO URLs in OpenCart
- Log in to Admin Panel: Start by logging into your OpenCart admin panel.
- Navigate to Settings: Go to
System > Settings
and click theEdit
button for your store. - Enable SEO URLs: Under the
Server
tab, set the "Use SEO URLs" option to "Yes" and save your changes. - Modify
.htaccess
File:- Rename the
htaccess.txt
file in your store’s root directory to.htaccess
. - Ensure your server is configured to use mod_rewrite (Apache) or a similar module for other servers.
- Rename the
Default htaccess code:
IndexIgnore *
Header set Referrer-Policy "no-referrer"
Header always set X-Content-Type-Options "nosniff"
Header always set Permissions-Policy "interest-cohort=()"
Options +FollowSymlinks
Options -Indexes
Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
RewriteEngine On
RewriteBase /
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|webp|js|css|svg)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Read more: 25 SEO best practices for Opencart 4
Managing SEO URLs
To manage or create SEO-friendly URLs for your store, follow these steps:
- Go to Design > SEO URL:
- From the admin menu, navigate to
Design > SEO URL
. - Here, you can view a list of existing SEO URLs and add new ones.
- Whenever you enter product, category, information page, manufacturer, etc, you will see an SEO tab where you enter the SEO URL, which is automatically listed here.
- From the admin menu, navigate to
- Adding a New SEO URL:
- Click the "Add New" button.
- Fill out the form:
- Store: Select store
- Language: Select Language
- Key: Enter the word that will be replaced in the URL for the page. Let's take an example URL https://demo.webocreation.com/index.php?route=product/product&language=en-gb&product_id=43, in this URL keys can be route, language, and product_id.
- Value: Value is unique as per the Key. For value, you can enter the URL parameter values, so in the above URL. Key is route and value is product/product, another key is language and value is en-gb, and key is product_id and value is 43.
If you try to enter a duplicate value, then you can get an error like below:
The most popularly used route in Opencart is available by default:
If you want to enter the route of the contact us page, whose URL is https://demo.webocreation.com/index.php?route=information/contact&language=en-gb, then you can enter as follows:
With that entry, now you can access the contact us page through the following URL: https://demo.webocreation.com/en-gb/contact - Keyword: Enter the desired clean and descriptive URL (in the above e.g., contact). This also needs to be unique.
Make sure you only use characters in the a-z or 0-9 range and – for spaces. Use / for categories. You can use _ for space, but sometimes it is not good for SEO, so always use -. - Sort Order: The sort order of the keywords in the URL. For example, URL https://demo.webocreation.com/en-gb/contact, the language en-gb is shown first and route contact is shown second, because the sort order for language is lower than the route.
Let's say we want to show route contact first and then language en-gb second, then we can adjust through sort order like below:
Now, the URL will be like: https://demo.webocreation.com/contact/en-gb
Read more: Remove en-gb from the SEO URL of Opencart 4 - Save your changes.
- Editing Existing SEO URLs:
- Locate the URL you want to edit and click the "Edit" button.
- Update the fields as necessary and save your changes.
Tips for Optimizing SEO URLs
- Keep It Descriptive: Use keywords that reflect the content of the page, like product names or categories.
- Avoid Special Characters: Use hyphens to separate words and avoid spaces or symbols.
- Be Consistent: Maintain a uniform style for URLs throughout your store.
Common Use Cases for SEO URLs
- Product Pages: Ensure each product has a unique SEO-friendly URL to improve its visibility.
- Example:
https://demo.webocreation.com/en-gb/product/macbook
- Example:
- Category Pages: Use SEO URLs for categories to help customers and search engines understand your store structure.
- Example:
https://demo.webocreation.com/en-gb/catalog/desktops
- Example:
- Custom Pages: Apply SEO URLs to information pages like "About Us" or "Contact Us."
- Example:
https://demo.webocreation.com/en-gb/information/about-us
- Example:
Troubleshooting SEO URL Issues
- Broken Links: Ensure the
.htaccess
file is correctly configured and the server supports URL rewriting. - Duplicate URLs: Avoid assigning the same SEO URL to multiple routes, as this can cause conflicts.
- Case Sensitivity: Be consistent with the case (uppercase/lowercase) in your SEO URLs.
Conclusion
The SEO URL feature in OpenCart 4 is a powerful tool to improve your website’s visibility and user experience. By enabling and carefully managing SEO URLs, you can drive more organic traffic to your store and enhance customer engagement. Take advantage of this feature to optimize your eCommerce platform for both search engines and your audience.