[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 10-16-2006, 09:58 AM   #1 (permalink)
Account Closed
 
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
55.39 NP$ (Donate)

NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice


.httaccess

Hi

How do i block people from seeing the following file:

/home/user/public_html/template/main.tpl

OR

http://www.domain.com/template/main.tpl

I need to .httaccess code for it please thanks.

Thanks
NetworkTown.Net is offline  
Old 10-16-2006, 02:58 PM   #2 (permalink)
NamePros Member
 
Join Date: Nov 2005
Posts: 28
0.00 NP$ (Donate)

c0demonger is an unknown quantity at this point


create a .htaccess file under /templates/

and put:

Deny From All

it should work.
c0demonger is offline  
Old 10-16-2006, 05:42 PM   #3 (permalink)
If only you knew...
 
maximum's Avatar
 
Join Date: Oct 2005
Location: Inside your head...
Posts: 919
128.65 NP$ (Donate)

maximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant future

Child Abuse Special Olympics Save a Life Baby Health Autism
c0demonger's suggestion (Thanks for trying to help, however ), is not complete, and a straight "deny from all" directive would prevent all files in the folder from being viewed. Try this in its folder:

<files main.tpl>
order allow,deny
deny from all
</files>

This prevents its direct viewing, but allows your other scripts to access it.
__________________
The smartest thing I ever did for my future was to start taking life seriously. The smartest thing I ever did for my present was to stop taking life so seriously

Last edited by maximum; 10-16-2006 at 05:48 PM.
maximum is offline  
Old 10-17-2006, 11:35 AM   #4 (permalink)
Account Closed
 
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
55.39 NP$ (Donate)

NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice


and if i want to deny a whole directory then?
NetworkTown.Net is offline  
Old 10-17-2006, 11:48 AM   #5 (permalink)
If only you knew...
 
maximum's Avatar
 
Join Date: Oct 2005
Location: Inside your head...
Posts: 919
128.65 NP$ (Donate)

maximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant futuremaximum has a brilliant future

Child Abuse Special Olympics Save a Life Baby Health Autism
Quote:
Originally Posted by NetworkTown.Net
and if i want to deny a whole directory then?
<files *.*>
order allow,deny
deny from all
</files>
ErrorDocument 403 "Access Denied to this file!


Denies direct access via browser to all files within the folder that have a "." and a file extention in the name (unless you are doing something funny, all files). Note the line:
ErrorDocument 403 "Access Denied to this file.
only has one " - This is normal, on most configurations. Leaving it out, you get a server error. Adding another " to the end, and the second one shows at the end of the sentence. This line is NOT neccessary at all (could be added in protecting one file, as my first reply was about, or blocking whole directory, by the way ) Basically, any "blocked" file they attempt to access directly in browser, just gives them that sentence when they try viewing the URL. Replacing the line with a URL would send them to that URL instead:
ErrorDocument 403 http://yoursite.com/AccessDenied.html

Hope this helps
__________________
The smartest thing I ever did for my future was to start taking life seriously. The smartest thing I ever did for my present was to stop taking life so seriously

Last edited by maximum; 10-17-2006 at 12:02 PM.
maximum is offline  
Old 10-17-2006, 12:58 PM   #6 (permalink)
NamePros Member
 
Join Date: Nov 2005
Posts: 28
0.00 NP$ (Donate)

c0demonger is an unknown quantity at this point


although mine works most of the time (for me at least), maximum's solution is the proper way of doing it

thanks maximum.
c0demonger is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 05:42 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85