Login Form



Latest Comments

Home : Blog : Htaccess

Htaccess

Blocking Users Or Sites By The Referrer With .Htaccess Code

E-mail
Saturday, 07 July 2007 08:05


Here is another good trick to block users that are coming from a domain.

When checking your logs on the server you suddenly see a many referrals from some site, but when you inspect that site closely you can not spot any incoming links from them.

Those referrals are not legitimate, they do not come from incoming links, the site is obviously hot linking your files especially images, css files or other files. The logs on your server will generate any kind of reference to your site that could be traced of course.

Blocking access by the referrer can be done with apache mod_rewrite to make a list of the referrers.

Usually mod rewrite is installed on most of the servers, but you can ask your host-support about mod rewrite. So to block all traffic that comes from a particular domain, use this code in the .htaccess file:

 

 

Read more...
 

Blocking Users By IP Or IP Blocks .Htaccess Code

E-mail
Saturday, 07 July 2007 07:12

Is there somebody who is giving you a hard time? Is he kind of stalking your site from hic computer. Well we have a cure for that. Block him, that pesky man.

You can add following code into your .htaccess file where you insert his IP's

order allow,deny
deny from 123.50.6.4
deny from 012.37.6.
allow from all


You can either deny access for an IP address of IP block You can deny access based upon IP address or an IP block. The result will be blocked access from the following IPs 123.50.6.4 and from any sub domain under this IP block 012.37.6. (012.37.6.1, 012.37.6.2, 012.37.6.3, 012.37.6.4 , etc…..)

There are other solutions also. You can deny access to everybody by inserting this code


deny from all

I do not think this is a good idea, only if you have some really top secret files on the server. You can also deny by domain name instead of IP address.

 

 

Creating Error Documents For Server Errors

E-mail
Saturday, 23 June 2007 16:49

Web Site Error Documents


Many times and SEO expert must know how to tweak .htaccess file. I must say it is essential to know how to do different redirects, tweaks, setting the error documents etc.

The error documents can be set in the .htaccess file that we talked earlier about. First let’s take a look of the list of the server returned error codes after that we will tweak our .htaccess file.

Read more...
 

How To Prevent Others Hijacking Your Content (Images, Flash, Music Files)

E-mail
Thursday, 21 June 2007 18:05

Well today we are going to learn how to deal against hotlinkers, that are using your content (images, flash, mp3s) instead of hosting them themselves. Below is the detailed explanation what to do in this case.

Even though somebody would think that if they use your pictures they are actually linking to your site so you will get benefits? Well that is not true. Hotlinking is not beneficial for search engine optimization. It can hurt your site SEO.

Some people are stupid enough to try to sue other websites for using their pictures. I say why bother. You can fix this tiny issue much quicker. We will try to get benefits out of hotlinking instead of suing those lazy webmasters J.

I see the hotlinking as a compliment, they obviously like your pictures, flash or music files and they are stealing it. At the same time they are using your bandwidth on your server and people can not see where the original location of that image really is. They could see it if the would look into the html code of the website.

Read more...
 

301 Redirect Puzzle Solved

E-mail
Sunday, 24 December 2006 15:31

Here is the 301 redirect instruction, how to do it on your site.

First you have to create a blank file and ftp it to your server in public html folder if you are using CMS - Content Management Systems or just the root folder of your site.

 

The file name should be

.htaccess

so be careful to put the . in front of the filename or it would not work.

And this is to put into your htaccess file

 


Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^xxxxxxxx.com [nc]
rewriterule ^(.*)$ http://xxxxxxxxxxx.com/$1 [r=301,nc]

 

 


Read more...