Help! Nowhere hidden to put private config file!

On the new website, all I’ve is a actual directory on my personal FTP.

I do not have any directories underneath it helping put config files, we don’t want anybody to determine. The people along at the host said in order to password protect the directory the config file is currently in (a subdir in the root) with htaccess, but merely do this then the PHP include()s won’t be able to access it.

Possibly there is any other way to make this file private on the outside world

With thanks!

You could take a step like this:

PHP:


if  (  $_SERVER'PHP_SELF'  ==  '/protectedFolder/protectedFile. php'  )
        die( 
'Private  record,   buddy.   Step  back again. '  );


I believe should work. Naturally, you change /protected… on the appropriate folder/file, relative on the *server root*.

Ah I see, so should the actual file inside the browser is the private one, it’s going to display the meaning, but if it is a different page as well as private file is just being included, it won’t Because it isn’t really the current page

I think I getcha.

With thanks, buddy

WE wouldn’t even show a message. Just forward them onto for your 404 page

Could do exactly the same by. htaccess making use of:

Code:
# -FrontPage-

IndexIgnore. htaccess */. * * *# */HEADER* */README* */_vti*

< Restriction GET POST>
arrangement deny, allow
not allow from all
permit from all
< /Limit>
< Restriction PUT DELETE>
arrangement deny, allow
not allow from all
< /Limit>
AuthName internet. example. com
AuthUserFile /home/example/public_html/_vti_pvt/service. pwd
AuthGroupFile /home/example/public_html/_vti_pvt/service. grp

RewriteEngine upon
RewriteCond %HTTP_REFERER! http: //example. com/. *$ NC
RewriteCond %HTTP_REFERER! http: //example. com$ NC
RewriteCond %HTTP_REFERER! http: //www. model. com/. *$ NC
RewriteCond %HTTP_REFERER! http: //www. model. com$ NC
RewriteRule. *\. (php)$ http: //www. model. com/404. shtml R, NC

If the letter for the file does not come form in your own domain, then it get directed for your 404 page. In this bit RewriteRule. *\. (php) list every one of the files you wish to protect separated by way of pipe. e. h. RewriteRule. *\. (phpincaspetc)

You should deal with your home directory within which can be your web origin, such as public_html or perhaps www. Store this kind of file above public_html or maybe www, not in just it. If the cause of your directory is the same as your web directory, I would uncover another host.

Used to do what you mentioned, well, almost, WE added the 404 like eKstreme suggested, like so:

Code:
<

whenever ( $_SERVER'PHP_SELF' == 'dir/file. inc. php')
header(" Site: /404/" );
die();


//... rest of file



(Replacing this dir/file with my personal actual file path)


But it really doesn’t redirect for the 404 when I check out the page around my browser.

What’s up with it Do you find it something I said

I’ve also tried accessing the website and the config file can’t be accessed through the actual PHP. (Using inclue() functions).

Update

Everything operates now _ This was just me being dumb.

Inside header() function, learn how to send a 404 error message This page hasn’t got the custom 404.

Discover this page: http: //www. webmasterworld. com/forum88/9255. htm. Read it all the way to the bottom ascertain a bug in IE.

I read all this, but I failed to see what meaning it had.

But I did put this at the top of my personal page insead:

PHP:

  if  (  $_SERVER'PHP_SELF'  ==  '/dir/file. inc. php'
   
header("HTTP/1. 0  404  Not  Found");
    die();
 


(Replacing this dir/file again using my actual report path)

But it’s still presenting me a ignore page.

Also OK.

Quite simply, what you does is correct: You might be generating a 404 header as well as browser will take note that. However, you immediately die() following your header. If you atart exercising . HTML in in between, it will be shown for a custom 404 page. For example:

PHP:

  if  (  $_SERVER'PHP_SELF'  ==  '/dir/file. inc. php'
   
header("HTTP/1. 0  404  Not  Found");
    echo 
"< p> This  page  cannot  be  determined.   Terribly  sorry  'bout  of which. < /p> ";
    die();
 


This will certainly print out this message. Of training course, you can add just as much HTML as you want.

I would recommend that you have a very single 404 error file that every pages of your site use.

Wish this helps…

All right, right.

I do have a 404 error page, so I could do this:

PHP:

if  (  $_SERVER'PHP_SELF'  ==  '/dir/file. inc. php'
   
header("HTTP/1. 0  404  Not  Found");
    include(
"404/file/path");
    die();
 


.

This entry was posted in Web Design and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *