Welcome to WebmasterWorld Guest from 184.108.40.206 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
mod_rewrite only one index.html page and not all index.html pages orgaseo
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:
<snip> RedirectMatch [ ...] [ foo.com ...] foo.com </snip>
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.
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.
Thanks jdMorgan for the head up... orgaseo
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 ;)
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... :(