Forum Moderators: phranque

Message Too Old, No Replies

New Virtual Host Problem

New Virtual Host Access Parent folder files ../

         

techhie

5:51 am on Jan 25, 2010 (gmt 0)

10+ Year Member




Dear All

I am new to Apache. We have a website that runs a web application, and another domain that points to same IP. the configuration is as below.

<VirtualHost *>
DocumentRoot /var/www/html/website2
ServerName www.website2.com
ServerAlias website2.com
</VirtualHost>
<VirtualHost *>

I have the web application, which runs on a different domain name, pointing to same IP.
<VirtualHost *>
DocumentRoot /var/www/html/webapp
ServerName www.website1.com
ServerAlias website1.com
</VirtualHost>
<VirtualHost *>

I created another domain name, which is mobile.website1.com .., pointing to same IP. basically, certain php pages of the mobile website will be the same as our web application, except the index and other pages. we do online payment processing, and those pages, we want to use the same, instead of making a copy of those pages in a different location.
What i did is, i copied

<VirtualHost *>
DocumentRoot /var/www/html/webapp/mobile
ServerName mobile.website1.com
ServerAlias mobile.website1.com
</VirtualHost>
<VirtualHost *>

and i started getting this error Directory index forbidden by rule new virtualhost

i added DirectoryIndex index.php, and the new site works well. I am wondering, without the Directory index, the other virtualhosts work fine. How. ?

My major problem, the pages like for example. the index.php has a href like this. ../buy.php , which is pointing to the parent folder (our original web application) folder. and i have references like ../includes/xyz.php and ../includes/abc.php

These references are throwing a 404 page not found error.

Can anyone help..

Thanks in advance.

jdMorgan

2:45 pm on Jan 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> and i started getting this error Directory index forbidden by rule new virtualhost

If Options DirectoryIndex is not set to enabled, and no index page exists (as defined by DirectoryIndex), then you get a 403.

For security, no virtualhost can 'see' above its DocumentRoot.
Therefore, resources in "/webapp/mobile" cannot refer to "/webapp" unless you define an Alias or a symbolic link to make the resources in "/webapp" appear to exist in "/webapp/mobile" as well.

Jim