Thank you, Tom, for your response and explanation. My understanding of the HTTP is pretty simple. I'm doing some research on the protocol as the second part of your answer is somewhat over my head. I follow (I think) that httpd considers each request separately to any other request (so, if httpd receives a GET for an HTML file and then a GET for a PNG, it doesn't infer that the PNG is to be displayed in the HTML file). What I don't quite follow is why httpd can't be told to spot an incoming request for one location and fetch a file at another. To see where my understanding is falling apart, I hope you will humour me with an abstracted exchange between the client and server in my situation: 1) Firefox to httpd: GET http://localhost/ClientWork/Drupal/ 2) httpd takes the request, fetches ~/www/CW/D/index.php, runs mod_php on index.php which returns, after some bouncing about, say <html>...<body>...<img src="/sites/default/files/images/banner.png" />...</body></html>, which httpd returns to Firefox 3) Firefox to httpd: GET http://localhost/sites/default/files/images/banner.png (one of many GETs in order to collect the images that need to be displayed) 4) httpd tries to fetch ~/www/s/d/f/i/b.png , doesn't find it, and bounces the 404. Assuming that the above steps accurately represent the exchange between Ff and httpd, am I to understand that there's no way to tell httpd in a .htaccess file at step 3 that a request in the form http://localhost/s/d/f/i/... should look for the file at ~/www/CWD/D/s/d/f/i/... ? On 27 November 2013 05:32, Tom Evans <tevans.uk@xxxxxxxxxxxxxx> wrote: > On Wed, Nov 27, 2013 at 5:37 AM, Borden Rhodes <jrvp@xxxxxxxxxxxxxxxx> wrote: >> Good evening, >> >> I thought that I had worded my question clearly. Is there something >> wrong with how I've asked my question or that I'm asking for something >> very unusual? >> >> I'll do my best to give you all of the information you need: >> >> I've copied a Drupal 6 website from a public webserver into my own >> webserver under /home/borden/www/clientWork/Drupal/ folder . My >> apache.conf file sets up a VirtualHost with DocumentRoot set to >> /home/borden/www . Therefore, when I want to browse the website on my >> local server, I point Firefox to http://localhost/ClientWork/Drupal/ >> which takes me to my local copy of the website. >> >> However, for various reasons, some images on the Drupal website are >> hardlinked to "/sites/default/files/images/..." This works fine on the >> public server, but on my local server, it's trying to fetch files from >> "http://localhost/ClientWork/Drupal/sites/default/files/images/" >> which, of course, is a non-existent folder. >> >> What I want to do is write an .htaccess rule so that, when Firefox >> requests the image at "/sites/default/files/images/...", Apache >> fetches the file at >> "http://localhost/ClientWork/Drupal/sites/default/files/images/..." >> >> I do not want to affect the server globally because I have other >> websites I fiddle with on this server, all neatly contained in their >> own folders. This rewrite rule I want only to apply to absolute links >> under "http://localhost/ClientWork/Drupal/" and not touch the other >> folders. >> >> If this is beyond Apache's capabilities, just let me know, and I'll >> try to find a way to trick the server using symlinks. If my request is >> still confusing, please help me explain my problem so that it can be >> understood. >> >> With thanks, >> > > So, to clarify. > > When you go to "http://localhost/ClientWork/Drupal/", it has <img> > tags with absolute URLs of > "http://localhost/sites/default/files/images/". > > You want requests for "http://localhost/sites/default/files/images/" > to be rewritten to > "http://localhost/ClientWork/Drupal/sites/default/files/images/". > > You only want this redirection to happen to links 'under > "http://localhost/ClientWork/Drupal/"'. > > The first requirement is trivial: > > Alias /sites/default/files/images > /home/borden/www/ClientWork/Drupal/sites/default/files/images > > The second requirement is impossible to achieve with mod_rewrite, > which is a tool for rewriting *requests*. HTTP is stateless, so a > request for "/sites/default/files/images/" is just that, it is not > "under" anything. > In order to only make your changes apply to pages "under" one URL > path, you would need to rewrite the *response* so that the URLs are > correct in the first place and you do not need to rewrite the > subsequent requests. > > The easiest way to do that would be to fix your drupal installation so > it generates the right content to start with. > > Cheers > > Tom > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx