Post by beata » Tue Nov 27, 2007 6:50 am

For example:
http://demo.opencart.com/catalog/template/default/
http://demo.opencart.com/library/
http://demo.opencart.com/cache/

The great news is that the config.php couldn't be browsed via internet. :D


Solution: use .htaccess to fix this problem.

/catalog/.htaccess:

Code: Select all

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/(image|css|javascript)/.*$
RewriteRule ^(.*) index.php [R=301]
/cache/.htaccess:
/library/.htaccess:

Code: Select all

RewriteEngine On
RewriteBase /
RewriteRule ^(.*) index.php [R=301]
Last edited by beata on Wed Nov 28, 2007 2:02 am, edited 1 time in total.

Newbie

Posts

Joined
Thu Nov 01, 2007 8:41 pm

Post by gv_ron » Thu Dec 13, 2007 11:45 am

If you're running Apache and have access to the configuration file (usually httpd.conf), there is another way to restrict directory listings (or Indexes).

Within the Apache section for your OpenCart Web site use Options to disallow indexes as follows.

Code: Select all

<VirtualHost 192.168.1.100:80>
DocumentRoot "/home/opencart"
ServerName www.example.com
ServerAlias example.com *.example.com
<Directory "/home/opencart">
    Options -Indexes
</Directory>
</VirtualHost>
By using a minus sign in front of Indexes, directory indexes are prohibited yet all other options remain unchanged.

Here's a link to the Apache documentation.

http://httpd.apache.org/docs/2.0/mod/core.html#options

The following snippet shows a way to simply disable all Options.

Code: Select all

<Directory "/home/opencart">
    Options None
</Directory>
Note that if you have another section for SSL you'll need to disable Indexes there too.

Newbie

Posts

Joined
Wed Dec 12, 2007 7:35 am
Who is online

Users browsing this forum: No registered users and 2 guests