We help IT Professionals succeed at work.

Why is FF browser displaying "you have chosen to open..." when I click on link to html page

weknowjack
weknowjack used Ask the Experts™
on
url: http://www.freemovefreemoney.com

Clicking on a link to an html page produces a pop-up from the Firefox Windows XP browser that says

"You have chosen to open
such_and_such_page.html,
which is a: Firefox document
What should Firefox do with this file?"
followed by selectable choices.

What would be causing this? It happens now on every link from the home page of this site.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
The server is sending the wrong headers, it's sending headers for a PHP script, but because it ends.html it won't be processed by PHP.

You need to have .php extension for PHP to process the page. Also, remove any bizarre apache configs causing it's mime type / headers to be sent incorrectly.

Author

Commented:
1. There is one php include file in the html. Does this require the page extension php?
2. What do you mean by bizarre apache configs? Are these in the page or somewhere else?

Commented:
1. The includes can be anything, myincludedfile.beer, it doesn't matter, they're not being executed at that point. It's the file that's being hit in the browser that executes. So it'll need to be .php. :)

2. Try the above first, that's probably your problem. I meant if you've set some unconventional filetype handing in apache.conf or .htaccess or something. But as you asked, probably not.

Author

Commented:
I guess what I'm not clear on is why php extension if there are no php tags except that include? The target page does contain a form that uses a php action file to process it. Other than that, it is an html page.

Commented:
If there's any PHP at all to be processed, even an include, it needs to have the .php extension. The server can be configured to treat files with any extension in any way you choose, but a default server config will need it to be .php.

The headers for that page are being sent as so, Content-Type: application/x-httpd-php, so the browser doesn't know what to do with it. So it offers it as a download.
The server should have done the processing and sent the content as text/html not application/x-httpd-php.

You don't have to have .php extension if you're not bothered about having any PHP code execute, but the problem here is why it's being sent with those headers. Check your .htaccess file, upload the contents here, and if you could explain a bit about your hosting/server setup, it might help determine why this is happening...

If you change the file to .php, it'll probably work, and you'll probably not have to fix the problem. So up to you, we can dig deeper to try to fix it, or just change it to .php and everything's fine...

 :)

Author

Commented:
To the htaccess in folder xxxx, i deleted

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

and replaced it with

RewriteRule (xxxx)/(.*)\.html$ /$1/$2.php [L]

All seems to be working now. Thought at first I should not have had the (xxxx) in the path above, since the htaccess is in that folder, but it works.

Commented:
I'm not sure why you need the line of code you replaced it with. Are you trying to run .html files as PHP? If so, why? You're going to cause yourself more problems in the future. It's fine to have filenames ending in .php...

The
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Rules explain everything.. Madness...

Glad you sorted it. :)

Author

Commented:
i did the rewrite to avoid having to change all the filenames manually. Is there a better way?
Commented:
You could write a script, or download a program to do it for you. If you're on Linux, it'll be quite easy to write a script to do it... But you'd have to post another question if you need help with that. It'd recursively enter directories, renaming files from .html to .php.

There's probably already software written to do this though, if you search, you may find...

Or the rewrite method you're using will do, but it's dodgy in the long run...

Author

Commented:
very fast replies