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
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
Share on other sites

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.