If you want to disable wget to download your site pages you need to declare wget as bad_bot. For that you need to add the following code in the .htaccess file located under website’s public_html directory.
after you inserted this code, if anybody tries to download your site pages using wget will receive a 403 error.

#Declare Wget a bad_bot
SetEnvIfNoCase User-Agent "^Wget" bad_bot
Order Allow,Deny
Allow from all
Deny from env=bad_bot

[email protected]:~# wget http://www.debian-tutorials.com/
--2013-02-14 xx:xx:xx--  http://www.debian-tutorials.com/
Resolving dev.slayergame.com... xxx.yyy.zzz.aaa
Connecting to www.debian-tutorials.com|xxx.yyy.zzz.aaa|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2013-02-14 xx:xx:xx ERROR 403: Forbidden.

You can stop others from hotlinking your site images by placing a .htaccess  file in your website main directory:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)debian-tutorials.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ http://www.debian-tutorials.com/wp-content/uploads/2012/12/hotlinkimage.png [R,L]

  1. The first line of the code enables the rewrite.
  2. The second line will block any website other than your own.
  3. The No case [NC] code will match the url regardless of being in upper or lower case letters.
  4. We allow empty referrals on the third line.
  5. The last line matches any files ending with the extension gif jpg and png. The hotlinked image will be replaced by the image specified here. You can also use here a link from another domain.

If you want to set email of the server administrator using .htaccess file use the following command.

Open your .htaccess with any text file editor and add :

SetEnv SERVER_ADMIN [email protected]

Now just save and reupload the file.



Apache2 is one of the most widely used HTTP server has a lot of features and can be customized in many ways.

In fact, to this web server, there are basically two ways you can do this, using .htaccess directives or using a file httpd.conf. .

Some people prefer to use. htaccess files, since they reside in the website and can be modified by the site owner, which is not the case for the daemon configuration file:


Permanent redirect  NON WWW to WWW using apache2 server configuration:
ServerName debian-tutorials.com
RedirectMatch permanent ^/(.*) http://www.debian-tutorials.com/$1
DocumentRoot /path/to/your/site/files/
ServerName www.debian-tutorials.com

New category

Valic —  October 9, 2011 — Leave a comment

All posts in this category will be useful snippets of different categories such as: bash, linux, mysql, apache, htaccess, and why wordpress and more.

Page 1 of 11