.htaccess issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fuchsia555
    New Member
    • Dec 2009
    • 56

    .htaccess issue

    hi everyone
    is it possible to point images to another website ?
    i mean for example:

    this domain doesn't host the image > http://domain1.com/image.gif

    this domain host the image > http://domain2.com/image.gif

    i want when i request ( http://domain1.com/image.gif ) it's point to the image on domain2

    is it possible by htaccess ?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Yes and I'll show how later today if no one else does.

    Comment

    • fuchsia555
      New Member
      • Dec 2009
      • 56

      #3
      thanks dear drhowarddrfine

      i hope it would be something like , domain1.com = domain2.com ,,, means any file requested will be point to it in domain2.com , and i hope it works with embeding , such like <img src" ....

      i'm waiting your reply .....

      Thanks

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        I'm out of town and having trouble remembering how to do this or what the best way might be. At first I was going to suggest this:
        Code:
        RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://www.othersite.com/ [
        R,NC]
        Which states that any file requests ending with a (.) and a jpg,jpeg, etc file extension should be rewritten to the other site but I can't recall if/how you can rewrite the last part to include the file name. So probably a redirect is in order and that's where I'm having trouble remembering what to do.

        EDIT:
        Try this:
        Code:
        RewriteCond %{HTTP_HOST} ^domain1\.com [NC]
        RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://domain2.com/$1 [R,NC]

        Comment

        • fuchsia555
          New Member
          • Dec 2009
          • 56

          #5
          thanks for reply
          it point to the domain with extension but without the filename
          for example:
          when i request domain1.com/image.gif it's point to domain2.com/gif

          Comment

          • fuchsia555
            New Member
            • Dec 2009
            • 56

            #6
            hello ??
            any help please ?

            Comment

            • drhowarddrfine
              Recognized Expert Expert
              • Sep 2006
              • 7434

              #7
              Sorry. Out of town till Monday.

              Comment

              Working...