Dynadot — .com Transfer

.httaccess

SpaceshipSpaceship
Watch

NetworkTown.Net

Account Closed
Impact
2
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
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
create a .htaccess file under /templates/

and put:

Deny From All

it should work.
 
0
•••
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.
 
Last edited:
0
•••
and if i want to deny a whole directory then?
 
0
•••
NetworkTown.Net said:
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 :blink:
 
Last edited:
0
•••
although mine works most of the time (for me at least), maximum's solution is the proper way of doing it :)

thanks maximum.
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back