Forum Moderators: phranque

Message Too Old, No Replies

add index page to the end directory path

         

Angelus

6:33 pm on Sep 25, 2010 (gmt 0)

10+ Year Member



Hi

I want to know how i can add index page to the end of directory path
for example if user type www.apachefurom.com/user/

the server should change that link to: www.apachefurom.com/user/index.html

i use redirectmatch but it's only work to some directory other not



Any help would be appreciated

thanks

g1smd

10:38 pm on Sep 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Don't change the URL or redirect the user.

Instead use
DirectoryIndex index.html
to directly serve the page at the requested URL.

If you should ever change your index page to use PHP, simply change that directive to
DirectoryIndex index.php
and the user will continue to use the same URL they always have.

They need never know what "technology" delivers the page. Cool URIs don't change.

Angelus

3:34 am on Sep 26, 2010 (gmt 0)

10+ Year Member



Hi thanks for your help
But i already set DirectoryIndex to index.html

but the problem is when i use FilesMacth to disable all files type expect html and php
the server will block everything if user type the directory path , it will be lock
so i need some help to configure server to serve index.html when user just type directory name


thanks

Angelus

5:32 am on Sep 26, 2010 (gmt 0)

10+ Year Member



It is possible to edit html page to add index.html to the current directory path

Any help guys would be appreciated

thanks

Angelus

2:29 pm on Sep 26, 2010 (gmt 0)

10+ Year Member



Any helps

jdMorgan

8:21 pm on Sep 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> but the problem is when i use FilesMatch to disable all files type except .html and .php,
the server will block everything if the user types the directory path - it will be locked.

Please post the <FilesMatch> directive you're trying to use. Also, post any "Options" directives you are using in your .htacccess file(s).

Also, please tell us where this .htaccess file is located in the server's filespace in relation to the "blocked directories."

Remember that URLs and filepaths are not at all the same thing, and that <Files> and <FilesMatch> test only the filename, and do not consider the directory path at all.

Jim

Angelus

3:43 am on Sep 27, 2010 (gmt 0)

10+ Year Member



i put this inside virtual host:

<Directory /home/www/user1>
SSLRequireSSL
Order Deny,Allow
Deny from all

DocumentError 403 /apacheerror/usererror.html

</Directory>


<FilesMatch "*.*">

Order deny,allow

Deny from all

Allow from none

DocumentError 403 /apacheerror/fileserror.html
</FilesMatch>

<FilesMatch "\.(html|php)$">

Order allow,deny

Allow from all

Deny from none

</FilesMatch>

jdMorgan

3:16 pm on Sep 27, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do not see any reason that this code should work differently when the user enters a directory path in the requested URL.

This could be a problem related to the way that various scopes are combined and resolved: See [httpd.apache.org...]

There's a bit of redundancy in this code. You might want to try:

<Directory /home/www/user1>
SSLRequireSSL
ErrorDocument 403 /apacheerror/usererror.html
Order Deny,Allow
Deny from all
</Directory>
#
<FilesMatch ".*">
ErrorDocument 403 /apacheerror/fileserror.html
Deny from all
</FilesMatch>
#
<FilesMatch "\.(html|php)$">
Allow from all
</FilesMatch>

Assuming that you simply mis-typed "ErrorDocument," there was only one real error "*.*" is not a valid regular expression. It might work in DOS, but not regex.

In regular expressions, "." means "Match any single character." The "*" is a quantifier meaning "Match any number (including zero) of the preceding character, bracketed character-alternative group, or parenthesized sub-expression. So ".*" means "Match anything and everything."

Be aware that with this set-up (or your previous one), your custom error pages *must* be either .html or .php files. Otherwise, you'll deny access to the error page, and any 403 error will become recursive (it will create an 'infinite' error loop.)

Jim

Angelus

2:09 am on Sep 28, 2010 (gmt 0)

10+ Year Member



Thank for your help you gave me many useful hints.

I'll try to fix it after read references on the links above


thanks again