Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7705547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:53:26+00:00 2026-05-31T23:53:26+00:00

I was shown this rewrite for getting images to redirect to a particular web

  • 0

I was shown this rewrite for getting images to redirect to a particular web page. And it allows for the usage of images on my site and others.

RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{REQUEST_URI}  ^/uploads/(\d+)-(.+)\.(png|gif|jpe?g|bmp)$  [NC]
RewriteRule (.*)  http://www.sitename.com/view/%1-%2/

This works great if I try to directly access an image from the address bar and I’m currently viewing my site. The problem I am noticing is if a user writes out a link on another site:

<a href="http://www.sitename.com/uploads/123-Charizard.png">Click</a>

It will take them to that image, not to the page.

What modifications should I be making to the rewrite so that it will redirect the user to the /view/ page.

EDIT: Another thing I have noticed is when posting an image to Facebook, using the above rewrite, it will not display the thumbnail as it once did. I am assuming this is something that cannot be worked around?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:53:27+00:00Added an answer on May 31, 2026 at 11:53 pm
    RewriteCond %{HTTP_REFERER} ^$  [OR]
    RewriteCond %{HTTP_REFERER} !^http://domain.com
    RewriteCond %{REQUEST_URI}  ^/uploads/(\d+)-(.+)\.(png|gif|jpe?g|bmp)$  [NC]
    RewriteRule (.*)  http://domain.com/view/%1-%2/
    

    For prevent caching:

    <filesMatch "\.(png|jpeg|jpg|gif)$">
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
    </filesMatch>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error message (shown in title), when I run this SQL
I have this in my .htaccess : RewriteRule ^images/([^/\.]+)/(.+)$ themes/current/images/$1/$2 [NC] RewriteCond %{REQUEST_FILENAME} !-f
I have List objects which are shown like this: www.mysite.com/lists/123 Where 123 is the
This is probably best shown with an example. I have an enum with attributes:
Premise This problem has a known solution (shown below actually), I'm just wondering if
This Delete partial view is shown in a jquery dialog: When the delete view
Why is this item not shown properly in my bibliography? @misc{ann, abstract = {ANN
Consider this simple XML document. The serialized XML shown here is the result of
My question involves this simple walkthrough shown in the article Preserve Size and Location
I am having this issue where Arabic letters are shown disjoint in any component

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.