.htaccess

driveflexfuel

New Member
Messages
159
Reaction score
0
Points
0
I have a directory call it /files in this directory i have files that are collected by php scripts randomly placed on the site. Is it possible to block visitors form viewing this directory by typing in site.com/files/filename.php but still be able to use filename.php as an include on my pages.
 

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
I think you don't even need .htaccess
Just change the permissions to 700?
 

driveflexfuel

New Member
Messages
159
Reaction score
0
Points
0
How would i go about doing that. I have never worked with changing permissions and they are not the easiest thing to search on the net.
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I think you don't even need .htaccess
Just change the permissions to 700?

.htaccess:

Code:
<Files *>
order allow, deny
deny from all
</Files>
Include and Require by php will still work though; apparently PHP bypasses the .htaccess requirement since apache isn't actually serving the page to the user, it's being used by another php document.


No idea how to change permissions though honestly, I've used this in the past but it's been a while - i -might- have the Files * line wrong, back stuff up before trying it!!!
 

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
^ Looks right to me Livewire.

To change permissions with X10's File Manger, select the file and press the 'Change Permissions' icon/text.
Then play around with the checkboxes until it says 700 at the bottom :)

Both methods should work, though.
 

driveflexfuel

New Member
Messages
159
Reaction score
0
Points
0
It works for the php includes but now i am wondering if there is a simaller way to do the same for a folder with js includes. I have a js file that holds promo numbers and i want to hide them from most people atleast
 
Last edited:

gomarc

Member
Messages
516
Reaction score
18
Points
18
It works for the php includes but now i am wondering if there is a simaller way to do the same for a folder with js includes. I have a js file that holds promo numbers and i want to hide them from most people atleast

PHP will run from the server side but JS is to run from the user side. This means that at one point, the js code needs to go to the user. Maybe you can find some answers at these posts:

http://codingforums.com/showthread.php?t=9442

http://www.webmasterworld.com/forum91/576.htm
 
Top