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
: 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
: : 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
: : : 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"?
: : : : 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.
: [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
Thanks foe sharing information about this topic.