Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Accessing Files Outside Of Document Root

ColacXColacX Posts: 141Member
Hello there. I wish to access files outside the document root. Just for simplicity we'll say the files are located local in "C:/files" and that the file i want is "file.txt" in the same folder.

I understand that I'm supposed to use "Alias" in my apache "httpd.conf" file, however I'm not sure how to write this code. Also I'm not sure how to write the link to the file.

This is what I tried
[code]
Alias "C:/files/"
[/code]
And the link would look like
[code]file.txt[/code]

Obviosly I guessed wrong since my apache server wouldn't even start after this change. Please help me. Thank you.

So I asked my tutor how to do this and he replied that It's possible using php. So I'll try that. However what does "Alias" do? and how to use it?

Comments

  • CyGuyCyGuy Posts: 312Member
    : Hello there. I wish to access files outside the document root. Just
    : for simplicity we'll say the files are located local in "C:/files"
    : and that the file i want is "file.txt" in the same folder.
    :
    : I understand that I'm supposed to use "Alias" in my apache
    : "httpd.conf" file, however I'm not sure how to write this code. Also
    : I'm not sure how to write the link to the file.
    :
    : This is what I tried
    : [code]:
    : Alias "C:/files/"
    : [/code]:
    : And the link would look like
    : [code]: file.txt[/code]:
    :
    : Obviosly I guessed wrong since my apache server wouldn't even start
    : after this change. Please help me. Thank you.
    :
    : So I asked my tutor how to do this and he replied that It's possible
    : using php. So I'll try that. However what does "Alias" do? and how
    : to use it?

    Configuring Apache isn't easy, but the break from the GUI is refreshing. Like windows shell scripts. Once you decide what you are going after, it is best to start with the basics.

    PHP and http.config are both parsed and should not cause the service to keep from running
  • zibadianzibadian Posts: 6,349Member
    : : Hello there. I wish to access files outside the document root. Just
    : : for simplicity we'll say the files are located local in "C:/files"
    : : and that the file i want is "file.txt" in the same folder.
    : :
    : : I understand that I'm supposed to use "Alias" in my apache
    : : "httpd.conf" file, however I'm not sure how to write this code. Also
    : : I'm not sure how to write the link to the file.
    : :
    : : This is what I tried
    : : [code]: :
    : : Alias "C:/files/"
    : : [/code]: :
    : : And the link would look like
    : : [code]: : file.txt[/code]: :
    : :
    : : Obviosly I guessed wrong since my apache server wouldn't even start
    : : after this change. Please help me. Thank you.
    : :
    : : So I asked my tutor how to do this and he replied that It's possible
    : : using php. So I'll try that. However what does "Alias" do? and how
    : : to use it?
    :
    : Configuring Apache isn't easy, but the break from the GUI is
    : refreshing. Like windows shell scripts. Once you decide what you are
    : going after, it is best to start with the basics.
    :
    : PHP and http.config are both parsed and should not cause the service
    : to keep from running

    The http.config is parsed when the service is started. Any errors encountered in the http.config will cause the service to be terminated before it truly starts.
    The Alias command maps an URL onto another URL. For more info see: http://httpd.apache.org/docs/2.2/mod/mod_alias.html
  • ColacXColacX Posts: 141Member
    : : : Hello there. I wish to access files outside the document root. Just
    : : : for simplicity we'll say the files are located local in "C:/files"
    : : : and that the file i want is "file.txt" in the same folder.
    : : :
    : : : I understand that I'm supposed to use "Alias" in my apache
    : : : "httpd.conf" file, however I'm not sure how to write this code. Also
    : : : I'm not sure how to write the link to the file.
    : : :
    : : : This is what I tried
    : : : [code]: : :
    : : : Alias "C:/files/"
    : : : [/code]: : :
    : : : And the link would look like
    : : : [code]: : : file.txt[/code]: : :
    : : :
    : : : Obviosly I guessed wrong since my apache server wouldn't even start
    : : : after this change. Please help me. Thank you.
    : : :
    : : : So I asked my tutor how to do this and he replied that It's possible
    : : : using php. So I'll try that. However what does "Alias" do? and how
    : : : to use it?
    : :
    : : Configuring Apache isn't easy, but the break from the GUI is
    : : refreshing. Like windows shell scripts. Once you decide what you are
    : : going after, it is best to start with the basics.
    : :
    : : PHP and http.config are both parsed and should not cause the service
    : : to keep from running
    :
    : The http.config is parsed when the service is started. Any errors
    : encountered in the http.config will cause the service to be
    : terminated before it truly starts.
    : The Alias command maps an URL onto another URL. For more info see:
    : http://httpd.apache.org/docs/2.2/mod/mod_alias.html

    Still I dont get it. How am I supposed to write it if my file is in "C:/files/files.txt"?
  • zibadianzibadian Posts: 6,349Member
    : : : : Hello there. I wish to access files outside the document root. Just
    : : : : for simplicity we'll say the files are located local in "C:/files"
    : : : : and that the file i want is "file.txt" in the same folder.
    : : : :
    : : : : I understand that I'm supposed to use "Alias" in my apache
    : : : : "httpd.conf" file, however I'm not sure how to write this code. Also
    : : : : I'm not sure how to write the link to the file.
    : : : :
    : : : : This is what I tried
    : : : : [code]: : : :
    : : : : Alias "C:/files/"
    : : : : [/code]: : : :
    : : : : And the link would look like
    : : : : [code]: : : : file.txt[/code]: : : :
    : : : :
    : : : : Obviosly I guessed wrong since my apache server wouldn't even start
    : : : : after this change. Please help me. Thank you.
    : : : :
    : : : : So I asked my tutor how to do this and he replied that It's possible
    : : : : using php. So I'll try that. However what does "Alias" do? and how
    : : : : to use it?
    : : :
    : : : Configuring Apache isn't easy, but the break from the GUI is
    : : : refreshing. Like windows shell scripts. Once you decide what you are
    : : : going after, it is best to start with the basics.
    : : :
    : : : PHP and http.config are both parsed and should not cause the service
    : : : to keep from running
    : :
    : : The http.config is parsed when the service is started. Any errors
    : : encountered in the http.config will cause the service to be
    : : terminated before it truly starts.
    : : The Alias command maps an URL onto another URL. For more info see:
    : : http://httpd.apache.org/docs/2.2/mod/mod_alias.html
    :
    : Still I dont get it. How am I supposed to write it if my file is in
    : "C:/files/files.txt"?
    :
    The following line maps c:/files to /outside in the url:
    [code]
    Alias /outside/ c:/files/
    [/code]
    If a visitor gets the following webpage:
    [code]
    http://mywebser/outside/files.txt
    [/code]
    The server presents him with c:/files/files.txt.
  • ColacXColacX Posts: 141Member
    : The following line maps c:/files to /outside in the url:
    : [code]:
    : Alias /outside/ c:/files/
    : [/code]:
    : If a visitor gets the following webpage:
    : [code]:
    : http://mywebser/outside/files.txt
    : [/code]:
    : The server presents him with c:/files/files.txt.
    Aha thank you now i understand
  • anderson123anderson123 Posts: 5Member
    Hello friends,

    Thanks foe sharing information about this topic.
Sign In or Register to comment.