Tag Archives: htaccess

htaccess force download file

Using the below part of code inside your htaccess file, you restrict the browser to download the file instead of displaying it in a seperate tab.

Two versions of the code, one for many filetypes and the second just only for pdf:

Various file types:

<FilesMatch "\.(?i:doc|odf|pdf|rtf|txt)$">
  Header set Content-Disposition attachment
</FilesMatch>

Only pdf:

<FilesMatch "\.(?i:doc|odf|pdf|rtf|txt)$">
  Header set Content-Disposition attachment
</FilesMatch>

taken form the drupal comnunity forum

WTF is Semalt.com?

No Semalt
No Semalt

As soon as i installed the google analytics code for tharsitis.gr , found out that i got too many  hits from Brazil.  Digging a bit more in the analytics report,  found that all the brazilian hits were coming from semal.com…

Semalt.com is an Ukrainian company that crawls the internet and generates reports on how your site compares to the rest of the internet, or the competition. Simply as that. Now why it needs to crawl my wordpress blog 16 times a day, i do not know. I only have like 5 posts yet :).

Any how, if you want to prevent semalt.com from crawling your web site, there are a couple of ways you can do that. One of them is through the .htaccess file. For wordpress i have changed my htaccess file to below (added the lines after # END WordPress, got it from here):

# Switch rewrite engine off in case this was installed under HostPay.
RewriteEngine Off
SetEnv DEFAULT_PHP_VERSION 53
DirectoryIndex index.cgi index.php index.html
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
SetEnvIfNoCase Via evil-spam-proxy spammer=yes
SetEnvIfNoCase Referer evil-spam-domain.com spammer=yes
SetEnvIfNoCase Referer evil-spam-keyword spammer=yes
SetEnvIfNoCase Via pinappleproxy spammer=yes
SetEnvIfNoCase Referer semalt.com spammer=yes
SetEnvIfNoCase Referer poker spammer=yes
Order allow,deny
Allow from all
Deny from env=spammer

Alternatively you could also visit their web site and ask them to remove your page.. (it did not work for me).