Index only display

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
bLaura Anderson [ Sa, 29 Dezember 2007 23:32 ] [ ID #1895708 ]

Re: Index only display

On Sat, 29 Dec 2007 17:32:19 -0500, Laura Anderson
<laura66b [at] yahoo.com> 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 :
<Files "..some (list of) filenames..">
Order Deny, allow
Deny from all
</Files>

or with :
<FilesMatch "..some rexexp..">
Order Deny, allow
Deny from all
</FileMatch>
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)
Kees Nuyt [ So, 30 Dezember 2007 03:06 ] [ ID #1896168 ]

Re: Index only display

On Dec 30, 9:32 am, Laura Anderson <laura... [at] yahoo.com> 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/')
lucanos [ So, 30 Dezember 2007 08:35 ] [ ID #1896170 ]
Webserver » alt.apache.configuration » Index only display

Vorheriges Thema: Mod_rewrite Problems
Nächstes Thema: Strange Problem With Apache 2.2.6 Startup Using mod_ssl.so & OpenSSL0.9.8g