rewrite image SRC

Discussion in 'Apache' started by wkdchris, Nov 10, 2012.

  1. #1
    Hi hoping somebody can help with this rewrite,

    I'd like to rewrite a image SRC-

    img src='/forums/public/style_images/master/profile/SEOFRIENDLYNAME_img.png'

    redirects to - /forums/public/style_images/master/profile/default_large.png

    So no matter what text replaces SEOFRIENDLYNAME as long as it detects the _img.png afterwards it shows the image /forums/public/style_images/master/profile/default_large.png
    Thanks
    Chris.
     
    wkdchris, Nov 10, 2012 IP
  2. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #2
    place this code in your .htaccess file:
    
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^forums/public/style_images/master/profile/([^/]+)_img.png$ /forums/public/style_images/master/profile/default_large.png [L]
    
    Code (markup):
    Cheers.
     
    pr0t0n, Nov 12, 2012 IP