www olarak yazılan adresleri www olmayan adrese yönlendirmek

Browser adres barına www… olarak yazılan adresleri www olmayan adrese  yönlendirmek için .htaccess dosyasına aşağıdaki satırlar yazılmalıdır. Tüm web sitesi www olmadan çalışacaktır.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.websiteniz.com [NC]
RewriteRule ^(.*)$ http://websiteniz.com/$1 [L,R=301,NC]

Hotlink koruması

Sayfanızdaki resim vb. öğelerin sizin sunucunuzu kullanarak başka sitelerde gösterilmesini engellemek için, web sitenizin root dizinindeki .htaccess dosyasına aşağıdaki kodlar eklenir; Burada hotlink adında bir klasör ve bunun içerisinde orjinal resmin yerine gösterilecek fake resimler mevcuttur.

# Hotlink Korumasi
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/hotlink
RewriteRule ^.*$ - [L]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?hakkiceylan\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?azgezmis\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?friendfeed\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?twitter\.com [NC]
RewriteCond %{HTTP_REFERER} !^https://(.+\.)?twitter\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?facebook\.com [NC]
RewriteCond %{HTTP_REFERER} !^https://(.+\.)?facebook\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?google\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?google\.com\.tr [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?haber\.gen\.tr [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?live\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yahoo\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yahoo\.com\.tr [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|JPG|JPEG|GIF|PNG|BMP)$ http://www.hakkiceylan.com/hotlink/0.$1 [L]
</IfModule>
# Hotlink Korumasi