Jump to content

Virtual directory in parent directory


daanoz

Recommended Posts

hey People

 

I got a question about creating a virtual directory link with .htaccess

 

Imagine my dir-structure as follows:

 

/www/vhosts/domain.com/httpdocs/.htaccess
/www/vhosts/domain.com/httpdocs/index.php
/www/vhosts/domain.com/php/virtdocs/index.php
/www/vhosts/domain.com/php/virtdocs/style.css

 

I configured my vhost as using the httpdocs directory as the root directory for domain.com, want I want is that when domain.com/virt/index.php, apache returns the file in the virtdocs directory, which is outside of the httpdocs directory.

 

Currently I got this working in a subdir at my (windows)localhost

 

RewriteRule ^virt(.*?)$ ../php/virtdocs$1 [NC,L,NE,PT]

 

But this gives me the following error on my linux vhost:

 

[Tue Dec 29 12:07:52 2009] [error] [client 195.241.119.125] Invalid URI in request GET /virt/style.css HTTP/1.1

 

So my question is how to solve this problem.

 

Thanks!

 

Daanoz

 

PS. I'd rather not use an absolute path like /www/vhosts/domain.com/php/virtdocs/ because this would make it more difficult to install on other systems

 

Link to comment
https://forums.phpfreaks.com/topic/186582-virtual-directory-in-parent-directory/
Share on other sites

Hmm, this does what I want... but it does require access to my apache configuration (or vhost configuration), which in my case I have, but on my some of my other boxes I don't...

 

Isn't there a way to simulate it with a .htaccess?

 

Daan

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.