0

Hello,
i am running a site consisting mainly of images . the problem im facing is high traffic loads sometimes from social networks on image links directly like : /i/image_123232.jpg instead of the image page.

I have developed teh site in a way to use same image name as teh url of image page.
For examples the image
/i/image_123456.jpg
will have page
/pic/123456

is there a possible redirect im the htaccess that i can redirect the traffic on the images to the image pages instead.

like traffic to : /i/image_12324353.jpg => /pic/12324353
Thx in advance:)

2
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by pritaeas
Featured Replies
  • 1

    Makes sense now. Because the image url is also redirected to this page. You probably need to add something like this: [icode] RewriteCond %{HTTP_REFERER} !^http://(www\.)?imgzzz.com/.*$ [NC] RewriteRule i/image_(\d+)\.jpg pic/$1 [L] [/icode] Read More

0

Hello,
Thanks alot, i tried it and a little variation but now what happens is. it is redirection the image properly to the right pages but on the page it doesn't show the image. what do u suggest further

0

Still not quite sure what your problem is. The pic/12 url shows the image and the rest of the page, but the image is still at i/image_12.jpg

If you use my rewriterule, it should not be possible to view _only_ the image in the browser.

Perhaps I misunderstood what you want to achieve.

Edited by pritaeas: n/a

0

K let me explain a bit further.
using your redirect it doesn't show the image o the image page as well.
i want the the direct image access to redirect on image page instead wehre uses can view the image ... inside teh page.
but with this rewrite rule it is redirecting direct access to page but not loading the image inside the page.
i hope that makes sense. right now i disabled your rewriterule

1

Makes sense now. Because the image url is also redirected to this page. You probably need to add something like this:

RewriteCond %{HTTP_REFERER} !^http://(www\.)?imgzzz.com/.*$ [NC]
RewriteRule i/image_(\d+)\.jpg pic/$1 [L]
Votes + Comments
awesome help thanks
0

Right now its implemented but it doesnt redirect the to image page on directly accessing

0

bravo man bravo worked :D thank u so much ! let me get into it a lil more i will get back to u :)
btw it wil not affect embeding of images outside the site right ?

0

If you try to access the image url, you will be redirected to the page, unless the request is coming from the server itself. Hot-linking directly to the image is now NOT possible.

Btw. the redirect now only works for jpg. If you allow other formats the rule has to be changed.

Edited by pritaeas: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.