WEB Servers

Moderators: None (Apply to moderate this forum)
Number of threads: 50
Number of posts: 79

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Accessing Files Outside Of Document Root Posted by ColacX on 15 Apr 2008 at 3:29 AM
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
<IfModule alias_module>
    Alias "C:/files/"
</IfModule>

And the link would look like
<a href="/files/file.txt">file.txt</a>


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?
Report
Re: Accessing Files Outside Of Document Root Posted by CyGuy on 17 Apr 2008 at 8:39 PM
: 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
:
: <IfModule alias_module>
:     Alias "C:/files/"
: </IfModule>
:
: And the link would look like
:
: <a href="/files/file.txt">file.txt</a>
:
:
: 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
Report
Re: Accessing Files Outside Of Document Root Posted by zibadian on 18 Apr 2008 at 4:35 PM
: : 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
: :
: : <IfModule alias_module>
: :     Alias "C:/files/"
: : </IfModule>
: :
: : And the link would look like
: :
: : <a href="/files/file.txt">file.txt</a>
: :
: :
: : 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
Report
Re: Accessing Files Outside Of Document Root Posted by ColacX on 19 Apr 2008 at 1:59 AM
: : : 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
: : :
: : : <IfModule alias_module>
: : :     Alias "C:/files/"
: : : </IfModule>
: : :
: : : And the link would look like
: : :
: : : <a href="/files/file.txt">file.txt</a>
: : :
: : :
: : : 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"?
Report
Re: Accessing Files Outside Of Document Root Posted by zibadian on 19 Apr 2008 at 2:05 AM
: : : : 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
: : : :
: : : : <IfModule alias_module>
: : : :     Alias "C:/files/"
: : : : </IfModule>
: : : :
: : : : And the link would look like
: : : :
: : : : <a href="/files/file.txt">file.txt</a>
: : : :
: : : :
: : : : 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:
  Alias /outside/ c:/files/

If a visitor gets the following webpage:
http://mywebser/outside/files.txt

The server presents him with c:/files/files.txt.
Report
Re: Accessing Files Outside Of Document Root Posted by ColacX on 19 Apr 2008 at 6:36 AM
: The following line maps c:/files to /outside in the url:
:
: 
:   Alias /outside/ c:/files/
: 
:
: If a visitor gets the following webpage:
:
: 
: http://mywebser/outside/files.txt
: 
:
: The server presents him with c:/files/files.txt.
Aha thank you now i understand
Report
Re: Accessing Files Outside Of Document Root Posted by anderson123 on 1 Nov 2012 at 11:23 PM
Hello friends,

Thanks foe sharing information about this topic.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.