Tag Archives: htaccess

Stop hotlinking from outside domains by using .htaccess

You can stop the hotlinking from outsider domain by using following rule in .htaccess RewriteEngine On RewriteCond %{HTTP_REFERER} ^http://(.+.)?domain.com/ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://(.+.)?domain1.com/ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://(.+.)?domain2.com/ [NC] RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L]

Manage www with .htaccess

For your domain if you require www you can achieve this by adding the following code in your .htaccess file: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteRule ^(.*)$