0

The situation

I use Carrierwave to upload images to the default upload/ directory. Works fine. When I want to view the images in the front end of my online web server, they don't show.

If I use my application in my local setup, the images show.

The only difference between my local and web server's setup is that on my server the application is run in subdirectory called "/app". Locally it's in the root directory.

What I have so far

I have this Redirect command in my .htaccess:

Redirect 301 /uploads/model/image/54/image.jpg /app/uploads/model/image/54/imgage.jpg

I want to formulate a general RewriteRule out of it so that all images which have the path "/uploads/model/image/" are found and redirected to "/app/uploads/model/image/".

How can I do that? I've tried several RewriteRules like:

RedirectMatch 301 /uploads/(.*) /app/uploads/

or:

Redirect 301 /uploads/model/image/(.*) /app/uploads/model/image//$1

or:

RewriteRule ^.*/app/uploads/(.*)$ http://%{HTTP_HOST}/uploads/$1 [L,R=301]

What I've read so far

I've read those entries on Stackoverflow:

I really have no idea why this happens would be very happy to get any hint, tip or link that could help me out of that.

Community
  • 1
  • 1
Naii
  • 3
  • 1

1 Answers1

0

You're close. Try:

RedirectMatch 301 ^/uploads/(.*)$ /app/uploads/$1

or

RewriteRule ^/?uploads/(.*)$ /app/uploads/$1 [L,R=301]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • YOU ARE GREAT! Thank you very very much! Made my day finally a successful one :) :) :) – Naii Sep 10 '12 at 15:10