You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by milan tomic <to...@yahoo.com> on 2011/10/21 09:32:05 UTC

[users@httpd] Map URL to directory

This is very simple question: what should I do in httpd.conf to map some URL
to the file system directory? I need something like this:

<Location /MyURL/SomeURL/>
  ProxyPass  D:\myDir\mySubDir
</Location>

Apache 2.2 on Win 2003 Server. I've been reading <Location>, <Directory> and
<Files> documentation and I haven't found any example.
-- 
View this message in context: http://old.nabble.com/Map-URL-to-directory-tp32694522p32694522.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Map URL to directory

Posted by Tom Evans <te...@googlemail.com>.
On Fri, Oct 21, 2011 at 6:53 PM, milan tomic <to...@yahoo.com> wrote:
>
>
> Pete Houston wrote:
>>
>> Most likely what you are after is the "Alias" directive.
>>
>
> Yes, Alias is what I need. But it doesn't work for me. I have this case:
>
> <VirtualHost *:80>
>  DocumentRoot "D:/Dir1/Dir2"
>
> <Location /MainPath/App1>
>  ProxyPass  http://tomcat1/MainPath/App1
> </Location>
>
> Alias /MainPath/AL "D:\Dir3\Dir4"
> <Directory "D:\Dir3\Dir4">
>  Order allow,deny
>  Allow from all
> </Directory>
>
> <Location /MainPath/>
>  ProxyPass  ajp://tomcat2/MainPath/
> </Location>
>
> ProxyPass /MainPath ajp://tomcat2/MainPath
>
> </VirtualHost>
>
> and when I visit http://apachehttpd1/MainPath/AL tomcat returns 404 not
> found :(

Tell Apache not to proxy that specific URL (no location block with this style):

ProxyPass /MainPath/AL !
ProxyPass /MainPath/App1 http://tomcat1/MainPath/App1
ProxyPass /MainPath/ ajp://tomcat2/MainPath/

Alias /MainPath/AL "D:\Dir3\Dir4"
<Directory "D:\Dir3\Dir4">
  Order allow,deny
  Allow from all
</Directory>

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Map URL to directory

Posted by milan tomic <to...@yahoo.com>.
Documentation says:

"Note however <Location> sections are run through once before aliases are
performed, so they will apply."

but it doesn say how to fix it :( What should I use instead?
-- 
View this message in context: http://old.nabble.com/Map-URL-to-directory-tp32694522p32698179.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Map URL to directory

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
>Pete Houston wrote:
>> Most likely what you are after is the "Alias" directive.

On 21.10.11 10:53, milan tomic wrote:
>Yes, Alias is what I need. But it doesn't work for me. I have this case:
>
><VirtualHost *:80>
>  DocumentRoot "D:/Dir1/Dir2"
>
><Location /MainPath/App1>
>  ProxyPass  http://tomcat1/MainPath/App1
></Location>
>
>Alias /MainPath/AL "D:\Dir3\Dir4"
><Directory "D:\Dir3\Dir4">
>  Order allow,deny
>  Allow from all
></Directory>
>
><Location /MainPath/>
>  ProxyPass  ajp://tomcat2/MainPath/
></Location>
>
>ProxyPass /MainPath ajp://tomcat2/MainPath
>
></VirtualHost>
>
>and when I visit http://apachehttpd1/MainPath/AL tomcat returns 404 not
>found :(

I am afrtaid you are instructing apache to pass /MainPath/ to tomcat, 
which includes /MainPath/AL ... maybe you could Alias /MainPath/AL 
within other Location directive. 
-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
- Holmes, what kind of school did you study to be a detective?
- Elementary, Watson.  -- Daffy Duck & Porky Pig

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Map URL to directory

Posted by milan tomic <to...@yahoo.com>.

Pete Houston wrote:
> 
> Most likely what you are after is the "Alias" directive.
> 

Yes, Alias is what I need. But it doesn't work for me. I have this case:

<VirtualHost *:80>
  DocumentRoot "D:/Dir1/Dir2"

<Location /MainPath/App1>
  ProxyPass  http://tomcat1/MainPath/App1
</Location>

Alias /MainPath/AL "D:\Dir3\Dir4"
<Directory "D:\Dir3\Dir4">
  Order allow,deny
  Allow from all
</Directory>

<Location /MainPath/>
  ProxyPass  ajp://tomcat2/MainPath/
</Location>

ProxyPass /MainPath ajp://tomcat2/MainPath

</VirtualHost>

and when I visit http://apachehttpd1/MainPath/AL tomcat returns 404 not
found :(
-- 
View this message in context: http://old.nabble.com/Map-URL-to-directory-tp32694522p32698123.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Map URL to directory

Posted by Pete Houston <ph...@openstrike.co.uk>.
Most likely what you are after is the "Alias" directive.

Pete

On Fri, Oct 21, 2011 at 12:32:05AM -0700, milan tomic wrote:
> 
> This is very simple question: what should I do in httpd.conf to map some URL
> to the file system directory? I need something like this:
> 
> <Location /MyURL/SomeURL/>
>   ProxyPass  D:\myDir\mySubDir
> </Location>
> 
> Apache 2.2 on Win 2003 Server. I've been reading <Location>, <Directory> and
> <Files> documentation and I haven't found any example.

-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107