Index only display

Index only display

am 29.12.2007 23:32:19 von bLaura Anderson

Hello,

Is there a way to tell Apache 2.2.4 to display only the index file of
a webstie regardless of what the complete URL was that got the user
there?

In other words, display index only on all requests.

Thanks.

Laura

Re: Index only display

am 30.12.2007 03:06:32 von Kees Nuyt

On Sat, 29 Dec 2007 17:32:19 -0500, Laura Anderson
wrote:

>Hello,
>
>Is there a way to tell Apache 2.2.4 to display only the index file of
>a webstie regardless of what the complete URL was that got the user
>there?
>
>In other words, display index only on all requests.
>
>Thanks.
>
>Laura

The easiest way is to point DocumentRoot to a directory
with only index.html (or whatever your DirectoryIndex
specifies) in it.

If there need to be other files in the directory you can
make them invisible with :

Order Deny, allow
Deny from all


or with :

Order Deny, allow
Deny from all

directives.

Of course you would also need :
Options -Indexes

HTH
--
( Kees
)
c[_] The future is here already. It's just
unevenly distributed. (William Gibson) (#271)

Re: Index only display

am 30.12.2007 08:35:49 von lucanos

On Dec 30, 9:32 am, Laura Anderson wrote:
> ...tell Apache 2.2.4 to display only the index file of a website regardless of what the complete URL...

If you have mod_rewrite as part of the Apache configuration (you
should - most commercially available servers do) then:

1) Create a file called ".htaccess"
2) Inside that file, put the following:
DirectoryIndex blocker.htm
RewriteEngine on
RewriteCond %{REQUEST_URI} !^$
RewriteRule ^(.+) /
3) Replace 'blocker.htm' with the file you want to display

What this does is
- Replaces the default page for any directory with the blocking file
- Responds to any URL, except for those going to the base of your
domain, with the default page ('http://www.server.com/')