tags:

views:

17

answers:

1

Hello,

My htaccess have this code

#
# Apache/PHP settings:
#

Options -Indexes
Options +FollowSymLinks

**# NOT WORKING #
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yourwebdomain.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?friend1domain.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?friend2domain.com(/)?.*$ [NC]
# NOT WORKING #**

# Set the default handler.
DirectoryIndex index.php

# PHP5, Apache 1 and 2
<IfModule mod_php5.c>
    php_value magic_quotes_gpc          0
    php_value register_globals          0
   php_value session.auto_start     0
   php_value memory_limit               128M
   php_value output_buffering           4096
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine on
  # Modify the RewriteBase if you are using zina in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /zina

  # Rewrite current-style URLs of the form 'index.php?p=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
</IfModule>

How do i prevent hotlinking from other site for my mp3 and jpg file?

My url for download mp3 end as http://www.domain.com/music/cat_one/band_name/file_mp3_name.mp3?l=12

A: 

You could encapsulate your links to your mp3 and jpg files inside javscript functions. In this way, you do not have a link in html, but a user action (liking clicking on some element) will trigger a javascript which in turn loads the mp3 or jpg via i.e. ajax.

This will stop most hotlinking because the other website would have to emulate a user (which is not impossible, but most often probably not worth the effort).

txwikinger