.htaccess / 301 redirect. [+repp!]

Discussion in 'Programming' started by roflux, Apr 15, 2008.

  1. #1
    Hi guys.

    I operate a music site which is a forum and links to my direct mp3s (which is on it's separate subdomain) anyway, some other forums are beggining to link directly to my mp3s - which in turn results in me losing bandwith.

    basically was wondering if i can implement some htaccess code on my subdomain (with all the mp3's) which ONLY allows to be accessed via the forums, so you CANNOT goto the site unless clicking on a link in my forums.

    Hopefully that all makes sense.

    Thanks very much all +rep for who can help.
     
    roflux, Apr 15, 2008 IP
  2. osdude

    osdude Peon

    Messages:
    76
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SetEnvIfNoCase Referer "^http://www.domain.com/" locally_linked=1
    SetEnvIfNoCase Referer "^http://domain.com/" locally_linked=1
    SetEnvIfNoCase Referer "^http://www.sub.domain.com/" locally_linked=1
    SetEnvIfNoCase Referer "^http://sub.domain.com/" locally_linked=1
    SetEnvIf Referer "^$" locally_linked=1
    <FilesMatch "\.(mp3)$">
    Order Allow,Deny
    Allow from env=locally_linked
    </FilesMatch>
    PHP:
    change domain to your domain

    I think that should do pt. I'm sure there's a more efficient way, but this is the only one I know
     
    osdude, Apr 15, 2008 IP
    roflux likes this.