httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
Subject Re: [users@httpd] Curious inability to mod_rewrite absolute paths
Date Tue, 19 Nov 2013 12:23:34 GMT
RewriteRule in htaccess strips the prefix used to get to the htaccess files
directory. What you compare to will never begin with /. This should have
been traced.
On Nov 19, 2013 6:06 AM, "Borden Rhodes" <jrvp@bordenrhodes.com> wrote:

> Good morning, list,
>
> After about 7 hours of struggling with this issue, I can't seem to
> find out how to trace the cause of this issue:
>
> I am trying to rewrite absolute URLs using a .htaccess file on my
> computer being served from localhost. I have succeeded in the
> following:
> Using, say, an HTML file containing the tag <img
> src="//www.example.com/image.png" />, I used "RewriteRule
> ^//(.*example\.com.*) http://$1" to get Apache to fetch the image;
> Using an HTML file containing the tag <img
> src="www.example.com/image.png">, I used "RewriteRule
> ^(.*example\.com.*) http://$1" to get Apache to fetch the image;
>
> However, using an HTML file containing the tag <img
> src="/www.example.com/image.png"> and "RewriteRule
> ^/(.*example\.com.*) http://$1", the webpage does not show the image.
> Further, turning the LogLevel up to trace8 and picking through
> error.log only shows that Apache failed to fetch the image from my
> file system (that is, /home/borden/www.example...) and didn't even
> pass the URL to the RewriteRule.
>
> Could someone explain why absolute URLs (which is what I'm simulating
> here) aren't getting caught by RewriteRule? The real problem I'm
> trying to solve involves needing to play with Drupal in a subdirectory
> of my localhost machine without changing any of the links. Therefore,
> suggestions to "rewrite the <img> tags" won't help. I ran the example
> from a simple website I set up in a folder on my server, not the
> Drupal installation.
>
> With thanks,
>
> Borden Rhodes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Mime
View raw message