Forum Moderators: phranque

Message Too Old, No Replies

can apache do this?

apache merge virtual path directory

         

wsly790104

3:27 pm on Mar 13, 2010 (gmt 0)

10+ Year Member



Hi, does anyone know whether apache can do this?

1. I have two disks in the server, say d:\ and e:\

2. now I want to present contents under d:\ and e:\ to ONE apache URL path, say
http://example.com/d_e_content/
.

Does anyone know whether apache can do this?

(notes, present ALL contents just under ROOT URL is must, this is NOT my need since it under two sub-directories of the ROOT URL:
http://example.com/d_e_content/d_disk/


http://domain.com/d_e_content/e_disk/



thank you very much and looking forward your reply!

[edited by: tedster at 6:13 pm (utc) on Mar 13, 2010]
[edit reason] switched to example.com - changed formatting [/edit]

g1smd

8:02 pm on Mar 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Look at the
alias
directive, I think.

wsly790104

1:20 am on Mar 14, 2010 (gmt 0)

10+ Year Member



Thanks g1smd, I have tried alias, but

Only d:/ content will be listed. Following is the httpd.conf.


Alias /d_e_content "d:/"
Alias /d_e_content "e:/"

jdMorgan

7:15 pm on Mar 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The Alias directive will need *some* difference in the requested URL-path in order to decide whether to map the request to the d: drive or to the e: drive.

So the answer to your question, exactly as posted above, is "No, Apache cannot do this." And neither can any other server.

If some difference in the URL-path cannot be created for use as a "drive selector" by mod_alias, your options are to use mod_rewrite or a script to check the full as-requested URL-path to see if it resolves to a file on either drive (or you could check for it on both drives) and if so, rewrite the requested URL-path to a filepath that resolves to that drive.

The problem with this is that it requires an additional one or more calls to the OS's filesystem handler to go check the disk for each and every HTTP request to the server, which is inefficient. If you are on shared hosting or a low-end dedicated box, this may make your site noticeably slower -- Not good considering that Google has announced that they will soon be considering page load time as a ranking factor.

Jim

Jim

wsly790104

4:59 am on Mar 15, 2010 (gmt 0)

10+ Year Member



jdMorgan, it is make sense, I appreciate.