Block access to directorie Block access to directorie
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Block access to directorie

Started by jonahnaylor, November 26, 2011, 07:29:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jonahnaylor

Hi does anyone know how to block access to directories such as album/uploads?

I've managed to put a .htaccess file together so if you put a full path of an image in it redirects to front page of the site but I'd like it to include dirs as when you navigate to the album/uploads path all the images are listed which can be clicked on and viewed?

If anyone can please help thanks.

I also have a redirect so that people putting the subdomain address and not the full domain in get redirected, however i'd also like to include those visiting from newdomain.co.uk/olddomain to be redirected to www.newdomain.co.uk too. Can anyone tell me the cleanest way to add these alterations and also stop visitors being able to view my original files in folders?

Currently my .htaccess looks like this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.newdomain.co.uk/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.newdomain.co.uk$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.newdomain.co.uk/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.newdomain.co.uk$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp.*.*jpg|jpeg|gif|png|bmp)$ http://www.yorkstockphotos.co.uk [R,NC]
RewriteCond %{HTTP_HOST} ^olddomain\.newdomain\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.newdomain\.co\.uk$
RewriteRule ^/?$ "http\:\/\/www\.newdomain\.co\.uk\/" [R=301,L]


Thanks for any help.

ΑndrĂ©

Quote from: jonahnaylor on November 26, 2011, 07:29:04 PM
when you navigate to the album/uploads path all the images are listed which can be clicked on and viewed?
Just disable directory listing with the help of your .htaccess file:
Options -Indexes