Welcome to WebmasterWorld Guest from 220.127.116.11 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Accredited PayPal World Seller
mod_rewrite only one index.html page and not all index.html pages orgaseo msg:1506975 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:
<snip> RedirectMatch [ ...] [ foo.com ...] foo.com </snip>
jdMorgan msg:1506976 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.
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.
orgaseo msg:1506977 7:45 am on Oct 29, 2004 (gmt 0)
Thanks jdMorgan for the head up... orgaseo msg:1506978 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 ;)
jdMorgan msg:1506979 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... :(