Monday, May 28, 2012

How do I configure website .htaccess only GoogleDocs Document Viewer can read the files

Open your .htaccess file in the root folder of the website. Add the below set of lines to it.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?:// [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteRule \.(doc)$ - [NC,F,L]

Using the google document embedded viewer
< iframe frameborder="0" src="" style="height: 500px; width: 600px;">

If we use the above hotlink protection then the url http:// is not accessible directly. Only Google Document viewer can access the file.


Popular Posts