Portal Home > Knowledgebase > Articles Database > .htaccess help
.htaccess help
Posted by howsthat, 10-04-2007, 02:03 PM |
i have a mobile download site.. now i dont want users to directly download from my site.. i mean hotlinking..
I hav a referal thing in my .htaccess
RewriteCond %{HTTP_REFERER} !^http://(www\.)?prince.uk.to(/)?.*$ [NC]
Now there is a flashget like software for mobiles.. i want that my users are able to download using that software but the prob is that soft doesnt sends any referal info.. so in my .htaccess i want to allow that software and i am trying this
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.*FGet 1.0.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?frendzforum.org(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?howsthat.uk.to(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?prince.uk.to(/)?.*$ [NC]
RewriteRule .*\.(zip|avi)$ - [F,NC]
where FGet 1.0 is the HTTP_USER_AGENT send by the software, but this doesnt works.. can plz give me the right code for it
|
Posted by howsthat, 10-04-2007, 02:09 PM |
when i use this
RewriteCond %{HTTP_USER_AGENT} ^-?$ it works
but
RewriteCond %{HTTP_USER_AGENT} ^FGet 1.0?$ it doesnt works.. so the prob seems to be in the FGet thing only.. how do i add that variable in the code
|
Posted by howsthat, 10-04-2007, 02:32 PM |
just checked the prob is only coz the user-agent name has a space.. i.e FGet 1.0
Is there any way by which i can even include the space and make the code work
|
Posted by david510, 10-05-2007, 02:28 AM |
Try using /s for space.
RewriteCond %{HTTP_USER_AGENT} ^.*FGet/s1.0.*$ [NC]
or
RewriteCond %{HTTP_USER_AGENT} ^.*FGet/s%1.0.*$ [NC]
|
Posted by zacharooni, 10-05-2007, 03:35 AM |
Don't you mean \s ?
|
Posted by david510, 10-05-2007, 03:43 AM |
SNC-Zach,
Yes, \s is correct. Thanks for pointing out.
RewriteCond %{HTTP_USER_AGENT} ^.*FGet\s1.0.*$ [NC]
or
RewriteCond %{HTTP_USER_AGENT} ^.*FGet\s%1.0.*$ [NC]
|
Posted by howsthat, 10-05-2007, 12:17 PM |
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !^FGet.* [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?frendzforum.org(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?howsthat.uk.to(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?prince.uk.to(/)?.*$ [NC]
RewriteRule .*\.(zip|avi)$ - [F,NC]
Finally the above code worked
|
Add to Favourites Print this Article
Also Read