Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: hello, how i enable apache to access an external folder outside of the webroot ?

  1. #1
    alrazy1 is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    38
    Rep Power
    0

    hello, how i enable apache to access an external folder outside of the webroot ?

    hello , how to enable apache webserver to access a folder found outside of the webroot in my case i have a xampp windows installation as a testing server in my machine, for example my php/html/jquery website is found in c:\xampp\htdocs and i want to force my website visitors to upload there files to an external folder outside of the /htdocs/ web root for example in c:\xampp\uploaded_files , now you are asking why i am doing that ? i am doing that because according to some tutorial they say its the best way to protect my website against hackers trying to inject/upload executable files like mainly php files....,that way even though a hacker succeeded to upload such bad files he cant access this folder because it is outside the web scope...
    now i have another question please do i have to take additional measures to protect that external folder maybe by installing a .htaccess file and restrict the access only to the apache webserver but not to the website visitors ?

    i am confused in how to do that correctly... !!
    i tried some tutorials by editing the C:\xampp\apache\conf\httpd.conf
    and i changed the directory configuration like that and that didnt worked either....:
    i changed this :
    Code:
    #<Directory />
    #    Options FollowSymLinks
    #    AllowOverride None
    #    Order deny,allow
    #    Deny from all
    #</Directory>
    with this :
    Code:
    <Directory /> 
     Options FollowSymLinks
     AllowOverride All
     Order deny,allow
     Allow from all 
    </Directory>
    and i tried to implement the upload to the xampp:\uploaded_files and that didnt worked.

    please tell me what i am doing wrong ?
    Last edited by Jaan; 03-06-2010 at 05:26 AM. Reason: Please use code tags when you are posting your codes!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    Wrong category

    I believe the .htaccess files can only do stuff with things inside it's current directory or sub directories.

  4. #3
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    But this wasn't about .htaccess, it was about httpd.conf, the config file where this is to be changed. Unfortunately, I'm not good enough on them...

    But I think you can create an alias...
    this is snipped from xampp conf file, so it should give a hint...
    Code:
    <IfModule alias_module>
        Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
        <Directory "C:/xampp/phpMyAdmin">
            AllowOverride AuthConfig
        </Directory>
    </IfModule>
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  5. #4
    alrazy1 is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    38
    Rep Power
    0

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    hi thank you for the help , but that didnt solved my problem i dont know why... i have added this to the httpd.conf file :
    Code:
    <IfModule alias_module>
        Alias /uploaded_files "c:\xampp\uploaded_files\"
        <Directory "c:\xampp\uploaded_files">
            AllowOverride AuthConfig
        </Directory>
    </IfModule>
    maybe somthing else causing my code not to work properly... ?
    do you know a simple way to check if my alias /uploaded_files is working 100&#37; ?
    i tried to browse to http://localhost/uploaded_files
    but that error what i got :
    ---------------------------------------------------------------------------------
    Object not found!
    The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

    If you think this is a server error, please contact the webmaster.

    Error 404
    localhost
    02/03/2010 23:09:15
    Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
    ---------------------------------------------------------------------------------
    Please help !!?
    Last edited by Jaan; 03-06-2010 at 05:27 AM. Reason: Please use code tags when you are posting your codes!

  6. #5
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    Have you restarted your apache server after the change of your httpd.conf? that is needed at starters. after that, do you have an index.html or index.php to show as default in that directory?
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  7. #6
    alrazy1 is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    38
    Rep Power
    0

    Smile Re: hello, how i enable apache to access an external folder outside of the webroot ?

    yes i have restarted apache webserver after i changed the httpd.conf , yes i created a very simple html index file and i installed it in the c:\xampp\uploaded_files, the problem isnt resolved yet unfortunately....thank you...

  8. #7
    alrazy1 is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    38
    Rep Power
    0

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    please help this thread isnt resolved yet !!!
    thanks

  9. #8
    mmo-dev's Avatar
    mmo-dev is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    81
    Rep Power
    0

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    Quote Originally Posted by alrazy1 View Post
    hi thank you for the help , but that didnt solved my problem i dont know why... i have added this to the httpd.conf file :
    Code:
    <IfModule alias_module>
        Alias /uploaded_files "c:\xampp\uploaded_files\"
        <Directory "c:\xampp\uploaded_files">
            AllowOverride AuthConfig
        </Directory>
    </IfModule>
    maybe somthing else causing my code not to work properly... ?
    do you know a simple way to check if my alias /uploaded_files is working 100&#37; ?
    i tried to browse to http://localhost/uploaded_files
    but that error what i got :
    ---------------------------------------------------------------------------------

    ---------------------------------------------------------------------------------
    Please help !!?

    hmmm seems u got something backwards kiddo

    <IfModule alias_module>
    Alias /uploaded_files "c:/xampp/uploaded_files/"
    <Directory "c:/xampp/uploaded_files">
    AllowOverride AuthConfig
    </Directory>
    </IfModule>

    hmm ok try that now and see if it works for u and u might wanna use a .htaccess file to make it so ur clients have 2 use a password to access the contents in that folder

  10. #9
    alrazy1 is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    38
    Rep Power
    0

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    hi , thnk you , your suggestion is ok but i have maybe a better idea... :
    <Directory "c:/xampp/uploaded_files">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    i appended this to the end of the httpd.conf and it worked...
    i think this method is better because there is no web link or alias name , and nobody from the web can access this internal directory because its outside of the web root and maybe also i can password protect it by using some .htaccess file.....

    please advice me if its a wrong approach , and why ?
    i think that way only my php scripts can access this directory .. please advice if i am write or wrong about that ?
    do you have a better way to protect data from hackers eyes?

  11. #10
    alrazy1 is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    38
    Rep Power
    0

    Re: hello, how i enable apache to access an external folder outside of the webroot ?

    hello again , i tried all the above in my xampp testing server /winxp and didnt worked i dont know why ?!!!
    please help.

    problem not resolved yet , please somebody help !

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 07-17-2009, 08:28 AM
  2. How do i enable changes in document during msgbox?
    By yonyts in forum Visual Basic Programming
    Replies: 5
    Last Post: 04-07-2008, 04:42 AM
  3. Enable rsync
    By ptt3 in forum Linux Installation & Configuration
    Replies: 0
    Last Post: 03-24-2008, 07:25 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts