Forum Moderators: coopster
this is what I have, can anyone help me?
<html>
<head>
<title>redirect</title>
</head>
<body>
<?php
if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], "en-au"))
{
Header("Location: http://www.yahoo.com.au");
exit;
}
?>
test1
</body>
</html>
<title>redirect</title>
</head>
<body>
test1
</body>
</html>
But I want my file to be saved as index.htm
how do I fix this?
to a file called .htaccess in the directory the .htm file is located. You can name as many file extensions as you like. Whether it will work depends on your host, some don't allow you to modify server behavior like that.
I'm curious, could this be written as
AddType application/x-httpd-php .php .php3 index.htm
This adds mime types and associates them with certain file extensions. You would need to either add all .htm files or none. To achieve what you want, you should probably use mod_rewrite on index.htm only and transform it to index.php.
In any case, why does the file absolutely need a .html extension? Is it because the *file* actually needs that extension or because the URI does?
If the former, then just name it .html and use the AddType directive to get it parsed as php.
If the latter, you can name it .html, .php or whatever you want and use mod_rewrite to change the URI. That said, I've said this a bunch of times, but by preference, URIs should not have file extensions. They should be
h**p://domain.com/page/
not
h**p://domain.com/page.html
h**p://domain.com/page.htm
h**p://domain.com/page.php
Tom