Jump to content

Common Mod_Rewrite usages


scrupul0us

Recommended Posts

Im surprised there isnt a sticky here for common usages

 

Heres how to prevent image hotlinking... place this in a .htaccess file in your server root

RewriteEngine on
RewriteCond %{HTTP_REFERER} .
#THIS WILL ALLOW GOOGLE
RewriteCond %{HTTP_REFERER} !google\.com [NC]
#THIS WILL ALLOW YOUR DOMAIN
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain\.com [NC]
RewriteRule \.(jpe?g|gif|png|bmp)$ - [NC,F]
#OPTIONAL REDIRECT TO A DIFF PAGE
#RewriteRule (.*) /no_hotlinking.php?/$1 [R,NC,L]

Link to comment
https://forums.phpfreaks.com/topic/38425-common-mod_rewrite-usages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.