You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Craig Tataryn <cr...@tataryn.net> on 2008/11/08 17:26:03 UTC

[users@httpd] Rewrite help

Hi, I have the following rules setup:

-----------------
Alias /root-resources /Users/craiger/root-test

RewriteEngine On
RewriteRule ^/freshaire/images/(.*)$ /root-resources/images/$1 [L]

RewriteRule ^/freshaire/community/images/(.*)$ /root-resources/ 
community-resources/images/$1 [L]
-----------------

How, if I fire up a browser and type:
Everything is fine if I navigate to:
http://localhost/root-resources/community-resources/images/someimage.jpg

But here I get a 404:
http://localhost/freshaire/community/images/someimage.jpg

You can probably see what I'm trying to accomplish here, not sure why  
it's not working?

I'm running Apache 2.2 under Mac OSX 10.5.5.

Any help would be greatly appreciated.

Craig.

--
Craig Tataryn
site: http://www.basementcoders.com/
podcast:http://feeds.feedburner.com/TheBasementCoders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
im: craiger316@hotmail.com, skype: craig.tataryn


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite help

Posted by Craig Tataryn <cr...@tataryn.net>.
Oh wow, thanks so much!  I had a similar setup before but I guess  
because "root-resources" was always mounted as the DocumentRoot in the  
past it worked!

Thanks again,

Craig.

On 8-Nov-08, at 10:42 AM, Eric Covener wrote:

> On Sat, Nov 8, 2008 at 11:26 AM, Craig Tataryn <cr...@tataryn.net>  
> wrote:
>> Hi, I have the following rules setup:
>>
>> -----------------
>> Alias /root-resources /Users/craiger/root-test
>>
>> RewriteEngine On
>> RewriteRule ^/freshaire/images/(.*)$ /root-resources/images/$1 [L]
>>
>> RewriteRule ^/freshaire/community/images/(.*)$
>> /root-resources/community-resources/images/$1 [L]
>> -----------------
>>
>> Everything is fine if I navigate to:
>> http://localhost/root-resources/community-resources/images/someimage.jpg
>>
>> But here I get a 404:
>> http://localhost/freshaire/community/images/someimage.jpg
>
>
> The second argument is a filesystem path, not a URL (unless you're
> redirecting or proxying).
>
> As a convenience, mod_rewrite will prepend your document root during
> the substitution your stuff isn't under the docroot so it doesn't save
> you here.  Have you tried using the full filesystem path in the 2nd
> parameter of the RewriteRule?
>
> RewriteRule ^/freshaire/images/(.*)$  /Users/craiger/root-test/$1 [L]
>
>
> -- 
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server  
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

--
Craig Tataryn
site: http://www.basementcoders.com/
podcast:http://feeds.feedburner.com/TheBasementCoders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
im: craiger316@hotmail.com, skype: craig.tataryn


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite help

Posted by Eric Covener <co...@gmail.com>.
On Sat, Nov 8, 2008 at 11:26 AM, Craig Tataryn <cr...@tataryn.net> wrote:
> Hi, I have the following rules setup:
>
> -----------------
> Alias /root-resources /Users/craiger/root-test
>
> RewriteEngine On
> RewriteRule ^/freshaire/images/(.*)$ /root-resources/images/$1 [L]
>
> RewriteRule ^/freshaire/community/images/(.*)$
> /root-resources/community-resources/images/$1 [L]
> -----------------
>
> Everything is fine if I navigate to:
> http://localhost/root-resources/community-resources/images/someimage.jpg
>
> But here I get a 404:
> http://localhost/freshaire/community/images/someimage.jpg


The second argument is a filesystem path, not a URL (unless you're
redirecting or proxying).

As a convenience, mod_rewrite will prepend your document root during
the substitution your stuff isn't under the docroot so it doesn't save
you here.  Have you tried using the full filesystem path in the 2nd
parameter of the RewriteRule?

RewriteRule ^/freshaire/images/(.*)$  /Users/craiger/root-test/$1 [L]


-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org