.htaccess redirect

Discussion in 'Apache' started by Zaiaku, Sep 26, 2009.

  1. #1
    I need to redirect only 1 file on my site. Actually its an image becuase it would take forever to get everything to update there urls so trying to have it done on my site.

    trying to get all links to
    domain.com/logo.jpg

    to point to:
    domain.com/images/logo.jpg

    This way no mater what url they put in their coding it will still load the image. Been trying to do it with htaccess but apparently everything I'm trying isn't working at all. Not sure if this effects anything but wordpress is installed in the rule of the domain as well.
     
    Last edited: Sep 26, 2009
    Zaiaku, Sep 26, 2009 IP
  2. chadsmith

    chadsmith Peon

    Messages:
    82
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteRule ^logo\.jpg$ /images/logo.jpg [R=301,L]
    Code (markup):
     
    chadsmith, Sep 27, 2009 IP
  3. Zaiaku

    Zaiaku Well-Known Member

    Messages:
    484
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Finally it worked. TY. One problem. Is thre any way to have this only happen with a certain domain. I have anothr domain parked on it and I don't want i to do this with boh domains.
     
    Zaiaku, Sep 27, 2009 IP
  4. chadsmith

    chadsmith Peon

    Messages:
    82
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can do that using

    RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$
    RewriteRule ^logo\.jpg$ /images/logo.jpg [R=301,L]
    Code (markup):
     
    chadsmith, Sep 27, 2009 IP
  5. Zaiaku

    Zaiaku Well-Known Member

    Messages:
    484
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #5
    TY works beautifully!
     
    Zaiaku, Sep 27, 2009 IP