homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

mod_rewrite only one index.html page
and not all index.html pages

 6:23 am on Oct 28, 2004 (gmt 0)

I try to get the 404 error messages out of my log.

Some bots try to access foo.com/index.html but there is now such file. There is only one foo.com/index.php which is the startpage.

But I have hundrets of index.html files in subdirs like foo.com/abc/index.html

I don't know how to handle it graceful via htaccess :(

This does not work:
RedirectMatch [foo.com...] [foo.com...]

Any Ideas?



 12:54 pm on Oct 28, 2004 (gmt 0)

Have you tried:

RedirectMatch 301 ^/index.html$ http://www.foo.com/index.php

You should not include the domain part in the pattern, and anchoring the URL-path pattern makes it more specific.

Specifying a 301-Moved Permanently redirect status will tell search engines to update the URL in their index. This will prevent problems with your search engine listings.

The RedirectMatch directive is not processed by mod_rewrite, but rather by mod_alias.



 7:45 am on Oct 29, 2004 (gmt 0)

Thanks jdMorgan for the head up...


 6:18 pm on Oct 30, 2004 (gmt 0)

Short question again:

Is it somehow possible to have the "DirectoryIndex" only for the frontpage?

www.foo.com/index.php <- DirectoryIndex

www.goo.com/2/34/567/index.html <- DirectoryIndex


There are around 500 subdirs and a htacess for all of them is a pain in the .. brain ;)


 1:33 am on Oct 31, 2004 (gmt 0)

DirectoryIndex, if set in your root directory, would have to be overridden in each subdirectory below your root directory (subdirectories below those subdirectories would not need an .htaccess file, they would inherit the setting from their parent directory.)

In your case case, I'd recommend you just set DirectoryIndex to index.html, and then use mod_rewrite to internally rewrite index.html to index.php in the root directory only. That would avoid having to put an .htaccess file in each subdirectory of root.

This problem is much easier to solve if you have access to httpd.conf... :(


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved