Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.