opencart current url

the seo guy requested to add link to current url to each H1 in the site so i found this code to do this

  <?php  $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>
  <h1><a href="<?php echo $url; ?>"><?php echo $heading_title; ?></a></h1>


opencart non www to www adds index.php?_route_=

this time it is about opencart and seo client needs to redirect site from non www to www all time so we added rule in .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


i added this to the end of file and it worked good but i had problem and it was showing index.php?_route_= after the base link like this

instead of


and after searching Google i found the solution

it was by putting these lines before the standard rules like this :

RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

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]


hope it will help someone



opencart Forbidden You don’t have permission to access

many times for some reason when u press save in opencart admin panel u get this


You don’t have permission to access /admin/index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


and start digging around and most of the times it is the same solution which i keep forgetting it is server issue and the answer is :

Mod_security is blocking this operation


so u need to talk to the hosting support to fix this and all will be alright



How to add a TPL files to Notepad++ as a PHP file!

Have you tried to add in “User ext” in to Notepad++ and the setting gone after the next program start up ?

Especially the Notepad++ installed on Windows 7 ? Here are the tips on how to make the setting save permanently in to the Notepad++.

Step 1 ) Run Notepad++ using from “Run as Administrator”.


Step 2) Go to “Settings”->”Style Configurator”.


Step 3) Add in the .tpl extension name into the “User ext” column by choosing PHP or html as a Language on from the options on left hand selection box.


Step 4) Click Save & Close on next.

Notepad++ will save the configuration permanently in future.

Enjoy !