Redirect Images to external url

Discussion in 'Site & Server Administration' started by wizzard, Mar 27, 2008.

  1. #1
    Hi,

    Via htaccess how is it possible to redirect images to an external url.

    Example => my images path local is /images/products/productname.jpg and the external is http://www.productsurl.com/images/productname.jpg

    Can someone helps me with this ?

    Cheers,
    Kris
     
    wizzard, Mar 27, 2008 IP
  2. wizzard

    wizzard Peon

    Messages:
    160
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Anyone ???
     
    wizzard, Mar 27, 2008 IP
  3. whittier

    whittier Active Member

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    I assume you are using Apache.

    Put a .htaccess file with the following code in the "products" directory:

    RewriteEngine on
    rewritecond %{http_host} ^.*$
    rewriterule ^productname.jpg/?$ http://www.productsurl.com/images/productname.jpg [R=301,L]
     
    whittier, Mar 27, 2008 IP
  4. Aphex

    Aphex Guest

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Do you really need to use .htaccess to do this?

    Why not just:
    
    <a href="http://www.sitename.com"><img src="imagename.jpg" border="0"></a>
    
    Code (markup):
    Or, am I not understanding you correctly?
     
    Aphex, Mar 28, 2008 IP