Re: Curious inability to mod_rewrite absolute paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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,

On 26 November 2013 06:18, Tom Evans <tevans.uk@xxxxxxxxxxxxxx> wrote:
> On Mon, Nov 25, 2013 at 12:47 AM, Borden Rhodes <jrvp@xxxxxxxxxxxxxxxx> wrote:
>> Thank you for your response, Tom,
>>
>> You are correct in that I don't expect the server to alter the HTML
>> output. I want to tell the server to fetch a file at an arbitrary path
>> if it receives a request for an absolute URL. So, for example, say I
>> have  <img src="/example/path" />, I want to use a a rule in an
>> .htaccess file to fetch the file at an arbitrary path, say
>> "/prefix/example/path" or "prefix.url/example/path", etc. I do not
>> want to change the global server settings, VirtualHost settings and/or
>> raw web pages. Alternately, I want to be able to have a page with <a
>> href="/example/path">link</a> and, when a user clicks on "link", be
>> directed to an arbitrary location.
>>
>> I forget that "//" denoted a protocol-independent URL, so thank you
>> for telling me.
>>
>> Again, I can use rewrite rules to rewrite relative and
>> protocol-independent URLs and get the file I want. However, even with
>> error logging turned up to the trace8 level, I cannot see absolute
>> URLs going into the rewrite rules in my .htaccess file. All I see,
>> from access.log, is the server trying to fetch the file from the
>> absolute URL (as you indicated in point 3 in your response) and
>> returning a 404 error because there is no file there (which is why I
>> want to rewrite it).
>>
>> I hope that's clearer.
>>
>
> I can't really make head or tail of this, apart from "I want to rewrite URLs".
>
> It would be easier if you showed your docroot, your actual URLs and
> what file/URL you want requests for those URLs to be rewritten to.
>
> 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





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux