PDA

View Full Version : How do I set up my ht access for redirects?


mrenaud
2005-10-18, 12:07 AM
I haven't got this figured out yet. I want my 404 traffic redirected back to my root.

the way I have things set up right now when I submit a free site for example the url will be adultpornos.net/freesites/bustybabe/index.html

So the surf can just browse my pics and directory without see my ads which obviously is no good. I had it set up so the directories were hidden but I want to redirect that traffic.

help me out please...
thanks

MeatPounder
2005-10-18, 03:39 AM
you can simply add a line in your .htaccess like this

ErrorDocument 404 http://adultpornos.net/

or to redirect basic errors do all these 400's and 500 as I do

ErrorDocument 400 http://adultpornos.net/
ErrorDocument 401 http://adultpornos.net/
ErrorDocument 403 http://adultpornos.net/
ErrorDocument 404 http://adultpornos.net/
ErrorDocument 500 http://adultpornos.net/

another thing you can do is set this to stop anyone from seeing the files in directories with no default page is to add this
Options -Indexes

the minus sign means simply not to show indexes of the files in the subdirectories

cd34
2005-10-18, 03:55 AM
Just a quick note, if you do

ErrorDocument 401 http://site.com/

you'll generate errors in the error log as it must be a 'relative' document url

ErrorDocument 401 /path/to.html

is what you want.

MeatPounder
2005-10-18, 11:04 AM
ahhh....yes relative path for the 401...glad to know that cd34 as I'm with you guys :)

mrenaud
2005-10-18, 02:16 PM
Cool seems to be working ok guys thanks

oast
2005-10-19, 09:42 PM
another thing you can do is set this to stop anyone from seeing the files in directories with no default page is to add this
Options -Indexes

the minus sign means simply not to show indexes of the files in the subdirectories

Or just put an empty index.html file in the folder

Doug E
2006-03-07, 07:36 PM
Apologies for bumpin an old thread, but would this be right ?

ErrorDocument 400 /main.html/
ErrorDocument 401 /main.html/
ErrorDocument 403 /main.html/
ErrorDocument 404 /main.html/
ErrorDocument 500 /main.html/

cd34
2006-03-07, 07:44 PM
you probably don't want the trailing slash at the end of those unless you actually have a directory called main.html :)

Other than that, make sure that any images loaded on main.html either have a base href, or, are linked with the full path, i.e.

<img src="/path/to/image.jpg">

Otherwise when someone goes to

http://yourdomain.com/asdf/asdf/asdf

they'll get broken images.

Doug E
2006-03-08, 08:14 AM
kk, i think i got that :)

thanks man