coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Permissions & Access Rights => Topic started by: bree on May 04, 2005, 10:13:07 AM

Title: Open directories
Post by: bree on May 04, 2005, 10:13:07 AM
Is there a way to stop people access the image directories on my site. A forum recently posted links to folders within my server so they could bypass the coppermine register only. For example:

http://www.michelletrachtenberg.net/gallery/albums/caps/
http://www.michelletrachtenberg.net/gallery/albums/icepremiere/

It allows all the folders and images within there to be accessed. If you go to http://www.michelletrachtenberg.net/gallery/albums it says it is unallowed which is what I want, is there a way to make that work for all the folders within the albums directory? I have bandwidth problems so I want people to register in order to be able to view pictures to help reduce the bandwidth usage.
Title: Re: Open directories
Post by: Tranz on May 04, 2005, 04:48:38 PM
Create a file called .htaccess and put it into the albums folder. In the file, put the following line:
Options -Indexes

I think this works with apache only.

You would also need to enable hotlink protection so that people cannot access the files directly if they know the URL to them. I posted the code for that so you should try searching.
Title: Re: Open directories
Post by: nol33t on May 04, 2005, 05:40:04 PM
a non web server dependent solution is to place in your sub albums directories an index.html file, the same that is in your albums directory:
you only got to change the line

<meta http-equiv="refresh" content="0; url=../index.php">

with

<meta http-equiv="refresh" content="0; url=../../index.php">


---------------------------


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Coppermine Photo Gallery - Albums Folder</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="0; url=../../index.php">
<style type="text/css">
<!--
body {
        font-family : Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        background : #F7F7F7 ;
        color : Black;
        margin: 20px;
}

h1{
        font-weight: bold;
        font-size: 22px;
        font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
        text-decoration: none;
        line-height : 120%;
        color : #000000;
}

p {
        font-family : Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        margin: 10px 10px 0px 0px;
}

-->
</style>

<!--
$Id: index.html,v 1.2 2004/06/11 12:19:25 tarique Exp $
-->
</head>

<body>
<h1><img src="../images/coppermine_logo.png" width="300" height="75" /></h1>
<h1>Coppermine Photo Gallery - Albums Folder</h1>
<p align="center">The contens of this folder aren't meant to be browsed. Visit the Coppermine Photo Gallery instead - you'll be redirected.
If you don't want to wait (or your browser doesn't support redirect), click <a href="../index.php">here</a>.</p>

</body>
</html>
Title: Re: Open directories
Post by: bree on May 07, 2005, 10:52:46 AM
Thanks so much! :) It works perfectly.
Title: Re: Open directories
Post by: nol33t on May 07, 2005, 12:20:06 PM
@bree: you did it for the "caps" but not "icepremiere" one is it normal?

@DevTeam: I'm using that trick on my own website too.
in the batch add script, when you add pictures from an album sub-directory, maybe it would be good to create this "index.html" in it automatically? ( check first if there's one, and if no create one )

-matt-
Title: Re: Open directories
Post by: nike on February 22, 2006, 09:23:51 PM
en fait, il suffit de faire ça :

Create a file called .htaccess and put it into the albums folder. In the file, put the following line:

Code:
Options -Indexes

et ça marche nickel pour tous les albums...

merci pour tout.