bypassing .htaccess for a one file in the directory in PHP application

Posted on 2005-05-10
Last Modified: 2010-04-22

Evevn though my problem is in PHP, but its related to the linux security so i tought that this is the right place to post this query. if not sorry.

 i m new to unix / linux env  , and i m developing a php application which is running on linux server with apache.

to control the admin files of our application we added a .htaccess file to our admin folder (where all our admin files are located).

but now at one part of my application i need to read the contents of one file in that folder(admin) using fopen , that time because of .htaccess , its not allowing me to that..

so is there any way to pass the user name and password from my php prog to .htacces file, or is it possiable to deny the .htaccess to one particular file in the same folder.

Thanks in advance.

Question by:rajups
    LVL 51

    Expert Comment

    > .. need to read the contents of one file ... using fopen
    do you mean PHP's fopen() function?
    Then this is not a .htaccess but a php.ini problem, for example  open_basedir
    LVL 5

    Author Comment

    hi  ahoffmann,

      Thanks u r response, but i think u r not clear on my intention is not to open a physical form, i ned to open a url and read its source , means , i had a php url like "", it will generate a invoice for the order no ineed to open a file with this url, thre by i can get the invoice of order no 5, as a html source, nd i need 2 pass it as an email to the customer.

    now the problem is as of its an invoice file, its in admin folder which is controlled by .htaccess when ever i m trying to open this file using fopen(), its not allowing me to open it.

    i think now its clear.

    thanks in advance.

    LVL 51

    Expert Comment

    do you mean to use fopen() from another server with the URL as parameter?
    LVL 5

    Author Comment

    hi  ahoffmann ,

    s, exactly and its not like from other server its like from any browser.

    can we do that.

    LVL 51

    Accepted Solution

    fopen()  from any browser?
    LVL 2

    Expert Comment

    You dont need your admin directory published in the web, so you dont need to protect it with .htaccess

    Try accessing the file using the full path e.g. /home/administrator/files/admin

    If this is located on other machine, consider using samba shares.

    Hope this can help a bit.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    ​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
    BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (, affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now