Closed Thread Icon

Preserved Topic: .htaccess questions (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=21094" title="Pages that link to Preserved Topic: .htaccess questions (Page 1 of 1)" rel="nofollow" >Preserved Topic: .htaccess questions <span class="small">(Page 1 of 1)</span>\

 
Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 08-08-2002 22:54

Ok I want to put a .htaccess file in a directory to make it give the user a 404 error when they type in that directoy.

So when they goto: mysite.com/mydirectory/ even though their is stuff there it will give them the default browser 404 error.

I tried using "IndexIgnore *" but that still show the directory, but will no files in it.

I tried "Redirect /mysite.com/directory/index.html > http://mysite.com/directory/404.html"

and that does work fine but I want to just make them have a 404 error rather than sending them to my custom 404 error page.

Yeah I know that sounds odd but it's what i'd like to do, I just can't think how to do it



Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-09-2002 04:34

Synthetic: Might you be better off with a 403 as that is more conventional or is your heart set on 404?

[emp edit: You'll need to look into mod_rewrite to do what you want I suspect - on rereading your post]

___________________
Emps

FAQs: Emperor

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-09-2002 08:00

The standard way to block showing folder contents is to remove "Indexes" option from folder options...

Just put the following in your .htaccess file:

Options -Indexes

And when someone tries to access that folder, Apache will throw 403 Not Authorized error, which is *standard* error for this...


Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-09-2002 17:00

I think he's trying to pretend that the dir doesn't exist...


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 08-11-2002 00:33

RedirectPermanent /directory http://yoursite/404.html

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-11-2002 12:14

I think that's what he's trying to avoid...


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 08-12-2002 19:00

only way I can think up of is that or putting an index in there that fakes the server 404.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-12-2002 21:04

Or switch the default document of that directory to something else.

stinx
Bipolar (III) Inmate

From: London, UK
Insane since: Apr 2002

posted posted 08-13-2002 14:35

You should be able to fake a 404 error by using

code:
header("HTTP/1.0 404 Not Found");


in your default doc as explained in http://www.php.net/manual/en/function.header.php

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

posted posted 08-15-2002 19:34

Maybe this can be useful: http://www.plinko.net/404/

« BackwardsOnwards »

Show Forum Drop Down Menu