Forum Moderators: phranque
Why? Do you have links to that URL? Are you sure these are legitimate requests?
The problem's easy enough to fix. Instead of using mod_alias Redirect or RedirectMatch directives, use mod_rewrite instead. Before redirecting, though, check the requested hostname to be sure it's not one of the not-to-be-redirected subdirectories.
DirectoryIndex index.php
#
Options +FollowSymLinks
RewriteEngine on
#
# If main domain or www subdirectory only
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
# redirect requests for "index.htm" to "/"
RewriteRule ^index\.htm$ http://www.example.com/ [R=301,L]
That's the recommended way to do this -- Link to example.com/ as your home page. Don't used index.anything as your home page URL in links or anywhere else. There is no reason to publish your Web site's technology (.html, .php), and this makes your URL shorter and easier to remember, and makes your site look more professional.
Jim
Yes, to both questions. I have only recently converted to php and I have a lot of html (and shtml) links spread around the 'net.
Thanks for the solution Jim ... I wouldn't have come up with that in a million years. The only thing I've thought of (since posting) is to set up an Apache Handler to parse htm as php and then have a dummy index.htm with the single line <?php header("location: index.php");?>. Seems a bit of a botch and I'm much happier with your method.
Thanks