Hi!,
I have 2 rules declarations in htaccess1) To prevent HOT LINKING
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://example.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.com$ [NC]
RewriteRule .*\.(.*)$ http://www.example.com [R,NC]
2) To redirect "example.com" to "www.example.com"
RewriteEngine OnRewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
How can i declare both in combined and efficient form (so that both works) in my htaccess file???
try to use this
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ - [F]replace domain.com with your domain
Hi there,
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]should be
RewriteRule %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]
AND there should be L (last rule somewhere, like
RewriteRule \.(gif|jpg|js|css)$ - [F,L]
Am I correct??
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |