Hotlink code in htacces not working with GoDaddy Hosting,

Discussion in 'Apache' started by mrkool, Aug 10, 2011.

  1. #1
    I am trying to prevent hotlinking my images and files, I have inserted following hotlinking code in my .htaccess file but it is not working at all.

    Hosting: GoDaddy Shared Linux 4G


    Following are the contents of my htaccess file. (Changed my domain to mydomain.com )

    
    ErrorDocument 400 /help/error/404.php
    ErrorDocument 403 /help/error/404.php
    ErrorDocument 404  /help/error/404.php
    
    
    #Stop hotlinking
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !=""
    RewriteCond %{HTTP_REFERER} !^https?://([^/]*)?mydomain\.com/ [NC]
    RewriteRule \.(jpe?g|gif|png|flv|mp4|mp3)$ -[F,NC]
     
    
    
    # compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    
    # Or, compress certain file types by extension:
    <Files *.html>
    SetOutputFilter DEFLATE
    </Files>
    <Files *.php>
    SetOutputFilter DEFLATE
    </Files>
    <Files *.js>
    SetOutputFilter DEFLATE
    </Files>
    <Files *.css>
    SetOutputFilter DEFLATE
    </Files>
    <Files *.htm>
    SetOutputFilter DEFLATE
    </Files>
    
    <FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|js|css|swf)(\.gz)?$">
    Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
    Header unset ETag
    FileETag None
    </FilesMatch>
    
    <IfModule pagespeed_module>
       ModPagespeed on
       ModPagespeedEnableFilters extend_cache
       ModPagespeedEnableFilters collapse_whitespace
    </IfModule>
    
    PHP:
     
    mrkool, Aug 10, 2011 IP
  2. helpinghost

    helpinghost Active Member

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    53
    #2
    The basic mod_rewrite conditions look ok to me.
    How exactly are you testing if it is working or not?
     
    helpinghost, Aug 10, 2011 IP
  3. mrkool

    mrkool Active Member

    Messages:
    261
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Through hotlink checker website.

     
    mrkool, Aug 10, 2011 IP
  4. mrkool

    mrkool Active Member

    Messages:
    261
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    85
    #4
    I also contact to GoDaddy support and as usual they said problem is from your side.
     
    mrkool, Aug 10, 2011 IP