Tag Archives: opencart .htaccess

.htaccess in opencart

First of all , let me give some brief idea regarding what is .htaccess.

– .htaccess is a configuration file for use on web servers running the Apache Web Server software.

– When a .htaccess file is placed in a directory which is in turn ‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by the Apache Web Server software.

– These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. These facilities include basic redirect functionality.

Enabling the .htaccess in opencart:

– By default opencart root have .htaccess.txt,you need to rename it.
just remove “.txt” from that file.

– Once you done this, you can find .htaccess file in your root folder.
That’s it.

Use of .htaccess in opencart: 

–  Default opencart .htaccess file having several methods,
lets understand it.

– The .htaccess will work to protect these files and the subfolders of System from being accessed by anyone except the designated administrator. To do so, insert the code below into your .htaccess:

# Prevent Direct Access to files
<FilesMatch “(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))”>
 Order deny,allow
 Deny from all
</FilesMatch>
– SEO URL Settings

RewriteEngine On
RewriteBase /Your_sub_directory_name
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [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]

If you want to access  your store like : www.mystore.com/shop then
put “shop” in place of “your_sub_directory_name” and if you want
to access your store like : www.mystore.com then remove
“your_sub_directory_name” in above code.

Looking for generate seo links by “A” click of all your store’s like,
have a look our extension : All in one seo module for opencart

 

 

. Stewinrephoper