Knowledgebase

Apache mod_rewrite and Hotlinking

Posted by dthbah2006, 04-03-2012, 11:09 AM
Hello, Apache mod_rewrite is enabled and working according to this test method: http://www.webune.com/forums/how-to-...abled-t40.html I have the following .htaccess file inserted in the public_html folder: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://mysite.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$ [NC] RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://www.mysite.com/nohotlinking.jpe [R,NC] All images can still be hotlinked from the site. What am I missing and what could be causing this issue?

Posted by Gabe_GoDaddy, 04-03-2012, 11:24 AM
Hey there dthbah2006, Give this code a try...

Posted by dthbah2006, 04-03-2012, 11:39 AM
Thanks for the suggestion but it did not work. What's amazing is the code above works on my other servers perfectly but not this one. I cannot understand why it's not working on this server.

Posted by Gabe_GoDaddy, 04-03-2012, 11:45 AM
Is there any notable difference between the servers? Are they shared? cloud? dedicated? Have you tried just a simple mod_rewrite to see if that works first?

Posted by dthbah2006, 04-03-2012, 11:48 AM
The servers were setup by the same server management team and I know of no differences between all of them. This test here is all I have tried to ensure that Apache mod_rewrite is enabled and working: http://www.webune.com/forums/how-to-...abled-t40.html What is simple mod_rew?

Posted by Gabe_GoDaddy, 04-03-2012, 12:04 PM
Just a simple redirect to test the function. When this and only this is in your .htaccess, you should be redirected to Google.com when you type yoursite.com/directoryonyoursite in a browser. If this does not work, have you restarted Apache after adding the .htaccess? Is the .htaccess in the root?

Posted by dthbah2006, 04-03-2012, 12:17 PM
I did as you stated and restarted Apache each time. Nothing redirected in the mysite.com/test/ directory. The only places I have placed the hot linking protection code are in the public_html folder and in a directory below the public_html. Nothing is working but this test says Apache mod_rewrite is working and enabled: http://www.webune.com/forums/how-to-...abled-t40.html Is this test trustworthy?

Posted by rcs, 04-03-2012, 12:37 PM
Check that you have AllowOverride All in httpd.conf

Posted by dthbah2006, 04-03-2012, 01:24 PM
It is there.

Posted by rcs, 04-03-2012, 01:38 PM
set it to None for /, it's a security major. set it for the directory of your rootdir You can check if .htacess is working by entering some crap into it (like: blablabla) and see if it gives you error 500. If it's working, then add RewirteLog and RewriteLogLvevel 9 to httpd.conf and debug the problem.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Hostdime/Dimenoc (Views: 535)
Servage.net down (Views: 508)


Language:

Client Login

Email

Password

Remember Me

Search