Jump to content

Access file in another directory


ciber

Recommended Posts

Firstly let me explain my directories:

 

/home/user/public_html/ which makes use of mysite.com

/home/user/images/ which makes use of img.mysite.com

 

basically I am splitting my images up, to monitor traffic on them - however, I need them to remain in the directory they are in.

Therefore, if a file is accessed img.mysite.com, how can I get the server to rewrite to /home/user/public_html/images/ ?

 

thanks

Link to comment
Share on other sites

The 'correct' way of doing this would not be via mod_rewrite. You should be setting up img.mysite.com with it's own named virtualhost via an apache .conf file. Assuming this isn't an option for you it can be done with mod_rewrite, you'd use something like this....

 

RewriteCond %{HTTP_HOST} ^img.mysite.com
RewriteRule ^.*$ http://mysite.com/images/%{REQUEST_URI}

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.