Log in

View Full Version : .htaccess


NY Jester
2007-11-09, 06:10 PM
Hey all, I wanted to set up my directories for custom error pages as well as my image directory from hotlinking or image thieves, here is what I have ..

for the error pages

ErrorDocument 402 http://www.my-site.com/error/index.htm
ErrorDocument 403 http://www.my-site.com/error/index.htm
ErrorDocument 404 http://www.my-site.com/error/index.htm
ErrorDocument 405 http://www.my-site.com/error/index.htm
ErrorDocument 500 http://www.my-site.com/error/index.htm

and for the hotlinking issue

RewriteEngine On
RewriteCond %{HTTP_REFERER} !http://www.my-site.com
RewriteCond %{HTTP_REFERER} !http://my-site.com
RewriteRule /* http://www.my-site.com/free-image-area/index.htm



Thanks
J-

|jester|

Cleo
2007-11-09, 06:29 PM
Almost

RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com:80.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com:80.*$ [NC]

RewriteRule (gif|jpg|png|swf|mpg|avi|GIF|JPG|PNG|SWF|MPG|AVI)$ http://www.yourdomain.com/bad.html [R,L]

ErrorDocument 400 http://www.yourdomain.com/404.html
ErrorDocument 401 http://www.yourdomain.com/401.html
ErrorDocument 403 http://www.yourdomain.com/403.html
ErrorDocument 404 http://www.yourdomain.com/404.html
ErrorDocument 501 http://www.yourdomain.com/501.html
ErrorDocument 502 http://www.yourdomain.com/502.html
ErrorDocument 503 http://www.yourdomain.com/503.htm

I have a rather old page of notes over here (http://www.cleos-porn-links.com/adult-links/webmaster-help.php)

NY Jester
2007-11-09, 06:41 PM
Cleo, thanks, I almost had it. And would that be almost the same thing for a certain directory only accepting entry from either your domain or a particular domain such a as an AVS link site etc? The {HTTP_REFERER} action?

Thanks

J-

|jester|

Maria
2007-11-10, 09:20 AM
Hi, I was doing some searching myself a while ago and read this article on webmasterworld.com about the correct format for redirecting a 404 error.
One of the things I read was this :

<<An errorDocument directive specifies what file to serve when each particular error number occurs in the server. You must NOT include the http:// or point to another server, otherwise you will NOT get the correct http error code sent back (404 will be returned as 302 in fact).>>

Hope this helps.

In my case I have:
ErrorDocument 404 /404.html

Else your 404 will look like a redirect to Google and other searchengines

NY Jester
2007-11-10, 04:51 PM
Well, for the most part. I believe 404 errors on adult web sites are usually "sneaky" surfers trying to by-pass the advertising and get straight to the good stuff. I mean we could never make a mistake and have a bad link |bullshit| Especially when using TGP traffic, if you have a directory of ..tgp/nov/gallery1.htm alot will try and look for gallery2.htm and so on. |badidea| In that case, I dont really care what error my server shows, but I want to try to get that surfer to a sponsor, whether it be through free email sign up, free trial or $1 trial. He was hunting for something for nothing, |angry| now he's going to have to work to get back to the good stuff. LOL |boobies| I want him/her clicking just enough that he breaks down and gets me the sale. |thumb

J-

|jester|