Jump to content

rewrite DocumentRoot


vitaly

Recommended Posts

Dear colleagues,

 

I have the following directory structure:

 

www.domain.com/projects/project1

www.domain.com/projects/project1/images

www.domain.com/projects/project2

www.domain.com/projects/project2/images

 

The problem is that inside HTML files image paths are specified using DocumentRoot /. This results in requests similar to:

 

www.domain.com/images

 

Obviously, this does not work, because images are located inside each project's own image folder:

 

www.domain.com/projects/project1/images

 

I would like to create a rule to solve this problem. I have tried the following:

 

RewriteEngine on

RewriteRule ^/$ /var/www/vhosts/pikkles.com/httpdocs/projects/fujichemical/astareal/beta/ [nc]

 

However it does not seem to work. I have checked the paths and they are correct. What am I doing wrong?

 

Thank you in advance.

 

Vitaly

Link to comment
https://forums.phpfreaks.com/topic/91074-rewrite-documentroot/
Share on other sites

This to me seems like a couple of questions in one, but I'll try and answer the best I can.

 

1) if you are coding projects in sub directorys, that you'll need to either use the full path to the images folder, ie http://www.domain.com/project1/images/img.png. Or if you link to the image in your html like images/bob.png, it'll try and load "images/bob.png" using your current folder as the base.

 

 

2) You might want into looking into using virtual hosts and sub domains if you want it to act like a real website I.e bob.domain.com - project 1, joe.domain.com - project 2.

 

 

I'm not sure if this helps you or not.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/91074-rewrite-documentroot/#findComment-467377
Share on other sites

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.