GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   how to block access to certain files? (https://gfy.com/showthread.php?t=553934)

spacedog 12-18-2005 05:31 PM

how to block access to certain files?
 
ok, here's a question I need some help with.

say I have domain.com/directory/
and in that directory is subdirectory images
subdirectory cgi bin & a few more subdirectories & in directory is html files & some php & .txt & the .css & some scripts

so, domain.com/directory/images
and domain.com/directory/cgi_bin
domain.com/directory/page10.php
domain.com/directory/page10.css

ok, now lets say visitor goes to domain.com./directory/page10.php and he cuts out page10.php so that it shows domain.com/directory & now he see's everything in that directory. What do I do so that people can not access this.

also, I want to deny access to all the scripts, php files & .css & denie access to anything at all that is not an html page or image
How can I block everyone out except for myself.

porncaster 12-18-2005 05:58 PM

for the record, what you want to do is called blocking directory listing.

ill assume that youre running apache because if youre not, you should be. if you are on shared hosting, forget about the first procedure below and hope that .htaccess is enabled for you. if its not, contact the server admin and ask him to enable it.

if you have access to apaches config file (httpd.conf) and you want to disable directory listing for your ENTIRE server:
- open httpd.conf
- search for <Directory "!webroot!"> where !webroot! is the folder that your html files for the above mentioned domain.com are in (ie. /var/www/html or c:\apache2\htdocs)
- look for a line that says 'Options Indexes FollowSymLinks' immediately after the above line. Remove 'Indexes'.
- restart apache

if you dont have access to httpd.conf, or dont want to turn off directory listing for your entire server, and you have .htaccess enabled:
- in domain.com/directory create a file named .htaccess
- add a single line 'Options FollowSymLinks' and save your changes

if you want to use .htaccess but the above doesnt seem to work, and you have access to httpd.conf:
- find <Directory "!webroot!"> as in the first procedure
- find the following line 'AllowOverride None' and change to 'AllowOverride All'
- restart apache
- do the second above procedure

sick of this yet?

more reading:
http://httpd.apache.org/docs/1.3/howto/htaccess.html
http://javascriptkit.com/howto/htaccess11.shtml

ill get back at you in this thread on the denying access thing. that is a related but potentially an even bigger pain than blocking directory listing.

can you post the vitals on your hosing (shared or not) and software?

Nookster 12-18-2005 06:02 PM

another work around is using php for redirection.
Code:

<?php
  header("Location: http://www.mysite.com");
?>

Save that above code as index.php and upload it into whichever directory you don't want them to be able to see the structure of. "mysite.com" will of course be where you want them to be redirected to. :2 cents:

spacedog 12-18-2005 06:18 PM

it is shared hosting, I do have htaccess & it is unix.
I did the htaccess & it denied the scripts in another directory access to files in the directory I tried blocking.

spacedog 12-18-2005 06:18 PM

Quote:

Originally Posted by Nookster
another work around is using php for redirection.
Code:

<?php
  header("Location: http://www.mysite.com");
?>

Save that above code as index.php and upload it into whichever directory you don't want them to be able to see the structure of. "mysite.com" will of course be where you want them to be redirected to. :2 cents:

I'm trying this right now. this should work

spacedog 12-18-2005 06:27 PM

and it did work :thumbsup :thumbsup thanks nookster
And thank you porncaster for the links. some good info there :thumbsup

ok, now, only thing it does not block is the .css & .js

when I type in the url to the .css I get a save prompt. what can I do so that people are not able to download my .css & .js files

Oracle Porn 12-18-2005 06:33 PM

god damn youve been here since 2001 and you dont know basic shit?
what the fuck have you been doing?

spacedog 12-18-2005 07:11 PM

Quote:

Originally Posted by Oracle Porn
god damn youve been here since 2001 and you dont know basic shit?
what the fuck have you been doing?


what's so basic about it?

i have directories & subdirectories & scripts that are dependant on files withing the root, the directories & the subdirectories & when I tried blocking via method above, it denied the script access to the files.

mod rewrite & htaccess & server config. are NOT basic to me.

I inserted the index.php as above, & it denies the script access to the css
I want to deny users from seeing the files in directories, but want the scripts to be able to read the files. I also do not want users to be able to print, download or view my .css & .js files


All times are GMT -7. The time now is 04:11 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123