Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> I Need Help To Use Htaccess To Allow Only My Server To See A Directory
shadowx
post Aug 29 2006, 11:23 AM
Post #1


A clever man learns from his own mistakes, a WISE man learns from those of OTHERS
*********

Group: [HOSTED]
Posts: 884
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719



Hi everyone

Ive finally got a bit of an opportunity to do some php coding for an organisation which shouldnt be too hard. But i want to have some php files which will be used as includes in another php script but for added protection i dont want these php files to be visible by the public. I know i can use htaccess to easilly hide these files but what im worried about is will the head script be able to see the includes it needs if the htaccess file is hiding the entire directory?

Obviously its no good if not even the local server can see its own scripts and i havent used htaccess properly before and i just wondered if i did use it to hide the includes directory will the first script still be able to access and include them correctly?

Thanks
Go to the top of the page
 
+Quote Post
rvalkass
post Aug 29 2006, 12:08 PM
Post #2


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,055
Joined: 28-May 05
From: Hertfordshire, England
Member No.: 7,593
Spam Patrol



When you say you don't want them visible, do you mean in a directory listing? If so, just add a blank index.htm file into the directory so a listing can't appear. This does mean that if people know the file name they can still open the file, but all they'll get is the HTML output, not the PHP code. As for using an .htaccess file, I'm not sure if PHP will still be able to access the files, as I tend not to use .htaccess much now.
Go to the top of the page
 
+Quote Post
electriic ink
post Aug 29 2006, 12:24 PM
Post #3


Incest is a game the whole family can play.
Group Icon

Group: [MODERATOR]
Posts: 1,205
Joined: 11-February 05
From: Heaven
Member No.: 3,709



If you don't want people to see or execute them then you don't need .htaccess, you can do it using php. It's a more compucated way than using .htaccess so you should only use this method if no-one can provide you with the .htaccess answer:
  1. Put this piece of code at the top of all files in the includes directory:

    CODE
    <? if (empty($permit)) {
                                                    exit (' You do not have permission to see this file! ');

                   } ?>

  2. At the beginning of each file which which requires the include files, place:

    CODE
    <? $permit = 'Yes'; ?>

Unfortuneately, I know little of .htaccess but I'll try and see if I can find anything on google....
Go to the top of the page
 
+Quote Post
shadowx
post Aug 30 2006, 07:19 PM
Post #4


A clever man learns from his own mistakes, a WISE man learns from those of OTHERS
*********

Group: [HOSTED]
Posts: 884
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719



Thanks for the suggestions, ill use the php method if i cant find a htaccess one, ill have a look myself as this is the first chance ive had to use the computer since i posted.

Maybe the htaccess method is very illusive or non exsistent ohmy.gif
Go to the top of the page
 
+Quote Post
CrazyRob
post Aug 30 2006, 07:51 PM
Post #5


ITS ALIVE.....MUHHHAAAA
*********

Group: Members
Posts: 532
Joined: 17-October 05
From: Chippenham UK
Member No.: 13,031



therre is a much simpler way than that all you need to do is encode them in IonCube or Zend and install the ioncube loaders or zend laoders on your server then oly your server will be able to esxactue them and the php files will be encrypted if taken off the server.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Who Thinks Trap 17 Is Th Best Server?(6)
  2. Open Php Page From Another Server(7)
  3. Gmail: 502 Server Error(20)
  4. Run A Lagg Free Server(5)
  5. How to setup DNS server in Linux Slackware(4)
  6. Private Server Ro .(157)
  7. Private Runescape Server(49)
  8. Informix To Sql Server (or How To Open .unl Files)(2)
  9. Own Server(9)
  10. How To Get New Ip Address(12)
  11. How Do I Make My Own Private Online Server Please Help Me Out.thank You For Your Time.(22)
  12. Runescape 2 Private Server Guide: Part 1(16)
  13. Runescape 2 Private Server Guide: Part 2(19)
  14. Runescape Private Server(51)
  15. Make A Home Server In Your Pc(11)
  1. I Have Install Windows 2003 Server(4)
  2. How To Display Images Of A Directory(4)
  3. Two Lan Ports Problem(2)
  4. Can You Suggest A Good Free Email Server To Download?(2)
  5. Xxx Stunt Landia(2)
  6. Runescape Through A Proxy(2)
  7. How To Make Your Own Counter Strike Source Dedicated Server!(6)
  8. New Server Creation Problem(3)
  9. Webmail Server Script(2)
  10. I Cant Access The Server!(1)
  11. New Runescape Private Server Ham-scape.no-ip.org(0)
  12. Python Server(1)
  13. A Web Server On Lan(8)


 



- Lo-Fi Version Time is now: 25th July 2008 - 09:41 PM