Htaccess url redirect for image directory

Hi guys, the thread name may be a bit confusing lol.

I have my images stored outside the root (public) folder of my server.
I want to be able to include the images on the page using clean urls. Basically without any ‘…/’, etc

The current url that works when accessing an image is
[I]http://localhost/vfw/public/../uploads/img/image.jpg[/I]

What I want to do is get rid of the ‘…/’ so the url looks like the following
[I]http://localhost/vfw/public/uploads/img/jpg/image.jpg[/I]

However, I would like this to work when the site is hosted directly in the root dir: ie:
[I]http://localhost/../uploads/img/jpg/image.jpg[/I]
To
[I]http://localhost/uploads/img/jpg/image.jpg[/I]

Look forward to your responses, this has been bugging me for the better part of the day :slight_smile:

Just incase you guys need it. This is my current .htaccess file:

Options +FollowSymLinks
IndexIgnore */*

# Turn on the RewriteEngine
RewriteEngine On

#  Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

Cheers

P.S. The links obviously wont work and the post editor wont let me remove the tag

michael,

mod_rewrite can only work on URIs that are publically accessible (Port 80). Therefore, you cannot access directories outside your webspace with redirects as they will be rejected by the server.

IF you are insisting on making your images UNavailable (IMHO, it’s a senseless thing to do as you’ll not be able to place them in your webpages), use a PHP script to fetch them and present them (don’t forget to send the file type in the image’s header).

Regards,

DK

Hi, thanks for the reply.

I realised how stupid my request was about 10 minutes after posting it:nono:
Didn’t get round to ‘removing’ the post.

Sorry for the time wasting.

Regards,
Michael

Michael,

No problem! There have been others with that same question so don’t feel bad.

I’ll leave the thread here to help others.

Regards,

DK