ciber Posted July 9, 2010 Share Posted July 9, 2010 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 https://forums.phpfreaks.com/topic/207227-access-file-in-another-directory/ Share on other sites More sharing options...
cags Posted July 9, 2010 Share Posted July 9, 2010 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 https://forums.phpfreaks.com/topic/207227-access-file-in-another-directory/#findComment-1083492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.