Forum Moderators: phranque

Message Too Old, No Replies

DocumentRoot

         

FiRe

6:48 pm on Sep 30, 2007 (gmt 0)

10+ Year Member



[localhost...] --> C:\AppServ\www

I have a folder called "blah" and I want it to become the DocumentRoot i.e.

[localhost...] --> C:\AppServ\www\blah

But I want to do this through .htaccess files only. Is this possible? I am running on windows xp and tried the following code in a file on the www folder:

DocumentRoot C:\AppServ\www\model

But I just get a 500 internal server error. Any ideas? Thanks in advance :)

encyclo

6:59 pm on Sep 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[httpd.apache.org...]
Context:server config, virtual host

ie. DocumentRoot cannot be used in .htaccess, so the short answer to your question is: no. :)

Could you explain in more broad terms what you need to do? You may be able to cook something up with mod_rewrite.

FiRe

7:09 pm on Sep 30, 2007 (gmt 0)

10+ Year Member



Yeh well basically in the "blah" folder I have paths specified like this...

<img src="/images/logo.gif">

Which is annoying because I have to change them to this:

<img src="/blah/images/logo.gif">

So I wondered what is they easiest way I could switch over the document root without going through the httpd.conf file..?

g1smd

8:20 pm on Sep 30, 2007 (gmt 0)

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



This is a simple job for a rewrite.

The URL shown in links on page will be www.domain.com/somefile.ext

User requests www.domain.com/somefile.ext and then a rewrite translates that to get the file from the /whatever/somefile.ext internal filepath.

Direct requests to the /whatever/ folder need to be either blocked, or redirected back to the correct root URL.

So, for completeness, there is a rewrite and a redirect involved.

FiRe

10:35 pm on Sep 30, 2007 (gmt 0)

10+ Year Member



How do I write this? I don't want to have to do this for every file in the folder do I?