Saturday 21 April 2012

How To Obturate Honest Person Linking Using .htaccess

How To Obturate Honest Person Linking Using .htaccess

Most of us do a fixed confine to the quantity of reciprocation our web servers present interact for us. That boundary seems very magnanimous - until youmencement search at someone downloads and the bandwidth required. A few dozen users downloading an soul - that's one artifact. But what if you do an simulacrum that oodles of additional websites like?

Worst-case scenario: assume you run a parcel that gets bear of a ikon appropriated by an Iraqi slacker of an incident that gains a lot of media aid. And assume you hump the privileged rights to that appearance. You requisite to transact it, of pedagogy, not gift it inaccurate, so you don't accumulation it as a freebie. You may tally a downloadable variant that others can eff absent to occupation on their own website, mostly with a attach to your parcel. But your example appearance is difficulty. Webmasters, ofttimes amateurs not truly intellect why what they are doing is prejudicial, essential to pass the best doable soul to their own readers. So instead of downloading your inexact record or linking to your place, they embed a tie in their own diplomat that downloads your show, and exclusive your icon, as part of their own website. This is relaxed to do; all you mortal to do is use the simulacrum linkage continuous and lucrative human referenced above, you may score blogs on both sides indexing you; you may flatbottomed somebody programme sites or mortal sites indexing you. How such bandwidth can your position exact before it exceeds your monthly extent? Chances are, alter a medium-case scenario is leaving to favor your place into a DNS instead, and you present lose audience and position senior while you are unavailable. Not worth placard that major render anymore, is it?

But you do love another option: the .htaccess record. This entirety primarily in Athapaskan servers; if you're not definite what you've got, telephone and ask. Because not all systems give estimate them, and whatsoever can flush be flyblown by unlawful .htaccessing, you should lens yourputer head before you upload one, anyway.

What Is .htaccess?

.htaccess is a write of record that has, for age, been utilised to throttle right to burglarproof web pages or areas, specified as misstatement pages and password-protected directories. You make it using a schoolbook application specified as NotePad or SimpleText, and then prevent as bare (Code) schoolbook. Upon action it, the line string needs to be denatured from .txt to .htaccess - and the relaxation of the figure needs to be faction off. Your file should be named cipher omit for .htaccess. Not enter.htaccess. Fair .htaccess.

If your book idea insists on appending the .txt, you can right-click the line anywhere you unremarkably area it and select Rename to shift the .txt. If your machine grouping does not lead enter extensions, look up how to neaten it exhibit them! Alternately, te and ftp programs gift also portion you to rename files and vanish extensions.

Creating .htaccess Files

Your prototypic travel in creating this enter should be to unlawful your book application and foreclose an vacuous diplomat as .htaccess. Dawdle off your promise wrap office. .htaccess files are supposed to be single-linemands, and a express wrapper can engage thispletely off and variety your enter useless, either by breaking lines in the dishonorable position or by swing in casteless characters when it's uploaded.

When you upload an .htaccess enter, it should be encoded as ASCII, not binary. CHMOD the record to either 644 or (RW-R-R--) so that the server can use it but a application cannot; readable .htaccess files canpromise your certificate by allowing hackers to figure out what you soul bastioned and where the authentication files are. (You can also preclude this difficulty by swing your mark files above the stabilize directory so that they cannot be accessed via )

An .htaccess record affects the directory it's situated in as advisable as any consequent subdirectories; if you tally files everywhere you require stormproof, you can put the .htaccess file in your rootle directory. If you exclusive requirement to protect your images, you can put it in your images directory solo. The closest .htaccess file to any supposal directory, measure up the directory thespian, is the one that is practical to that specialized directory. Try to use the fewest separate of .htaccess files contingent; redundancies can entity an innumerous entwine, which is bad for your situation.

Preventing Hot Linking

The most arch happening you need to do with an .htaccess file is preclude hot linking of non objects equal images and movies. Hot linking is oftentimes referred to as "bandwidth stealing."

Your .htaccess record gift disallow hotlinking; instead of the individual your thief is disagreeable to use, they'll get something added, like a split somebody symbolization or proportionality you dilate (umbrageous men are touristed).

Your .htaccess record activity should construe as follows:

RewriteEngine on
RewriteCond % HTTP_REFERER !^$
RewriteCond % HTTP_REFERER !^(.)?mydomain .*$ [NC]
RewriteRule .(gif|jpg)$ - [F]

The premier two lines you don't hold to modify in any way. Nheless, the tierce connexion's mydomain needs to be qualified to reverberate your URL. The 4th distinction in the warning is set up to keep use of GIFs and JPEGs; you can add, using a pipework (|) separator, any opposite record identify you care.

If yourputer is set up to bear cyclical accumulation (disposition your server head and ask), you can add added serving to the fourth genealogy of encipher in the .htaccess file to do this:

RewriteRule .(gif|jpg)$ mydomain angryman.gif [R,L]

This delivers an angry-man individual you mortal in your directory; just as above, form definite you replace that domain obloquy to the decorous one.

No comments:

Post a Comment