I am working for someone who runs a webshop. Now the webshop runs on Opencart software, and fortunately they support SEO Url rewriting. I have been trying to get this working for the last 2 hours and havent been able to get it right. I have done the following to the .htaccess file.
# 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
<FilesMatch ".(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
# 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 /opencart/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Additionally i have enabled SEO rewriting on opencart and given all products/categories etc. a SEO name.
Now the .htaccess file is located in: public_html/opencart/ so i have changed the RewriteBase from / to /opencart/
Still i get the following errors:
Not Found
The requested URL /aquaria/adm-aquaria was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Does anyone have a solution for me?
To give you an example i want the following link: http://aquadeco.eu/index.php?route=product/category&path=94_291 to look like this: http://aquadeco.eu/aquaria/adm-aquaria
3
Answers
Ok, wow i just found out i have been stupid the whole time. I had 2 .htaccess files. One which was the original without the right rewrite rules and 1 in my /opencart/ folder which had the right rewrite rules. What i did now is put the right rewrite rules into the .htaccess file in my root folder and it fixed the problem!! :D
You don’t have to put this
RewriteBase /opencart/
If your url are like this yourDomain.com/opencart/index…. Then
you will have to put RewriteBase /opencart/
end if; 🙂
with your url you don’t have to put RewriteBase /opencart/
only /
Regards
You put your site in sub directory so you have to make following changes
RewriteBase /opencart/ change to RewriteBase /
and
RewriteRule ^([^?]*) index.php?route=$1 [L,QSA] change to
RewriteRule ^([^?]*) /opencart/index.php?route=$1 [L,QSA]