Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am setting up my first site on my OSX, this is just for use on my machine so I can trial html fragments. When I open my local site and select any HTML file, it comes back as text. My test HTML file is as follows:

    <a>Hello World</a>

It is displayed as the actual text rather than the interpretedx text. The actual HTML returned is:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="1038.36">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier}

<p class="p1">&lt;html&gt;</p>
<p class="p1"><span class="Apple-converted-space">  </span>&lt;head&gt;</p>
<p class="p1"><span class="Apple-converted-space">  </span>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;</p>
<p class="p1"><span class="Apple-converted-space">  </span>&lt;/head&gt;</p>
<p class="p1">&lt;body&gt;</p>
<p class="p1"><span class="Apple-converted-space">    </span>&lt;a&gt;Hello World&lt;/a&gt;</p>

<p class="p1">&lt;/body&gt;</p>
<p class="p1">&lt;/html&gt;</p>

My apache config for my site is:

<VirtualHost *:80>
   DocumentRoot "/Users/X/web_dump/"
   ServerName web_dump
   ErrorLog /usr/local/logs/web_dump.log
   CustomLog /usr/local/logs/web_dump.log common
   AddType text/html .html

<Directory "/Users/X/web_dump/">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    AddType text/html .html

And firebug indicates that the page returned is of text/html format:

Date: Wed, 30 Nov 2011 20:10:26 GMT
Server: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8r DAV/2
Last-Modified: Wed, 30 Nov 2011 20:10:10 GMT
Etag: "a833cc-3ec-4b2f952a52c80"
Accept-Ranges: bytes
Content-Length: 1004
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

So my really dumb question is: how do I return my HTML file as a HTML file?

BTW: my Apache system is working well for the other applications that I am working on.

share|improve this question
up vote 1 down vote accepted

Your text editor (TextEdit? "Cocoa HTML Writer" seems generic enough that it might be something else) figured that you wanted to modify and HTML file's content without seeing the underlying code. Thus, all of the HTML that you entered, it escaped, thinking that was the intended content.

Edit it with something that's not trying to hide the underlying HTML from you.

share|improve this answer
Yep. I feel dumb. TextEdit did some magic I did not expect. Back to vi for me. – dave Nov 30 '11 at 21:05

The problem is not in the web server but in the way you are editing the html file: you are using TextEdit, editing in Rich Text mode and saving as html.

Instead, you should select the menu option Format->Make Plain Text and save as a plain text file with the html extension.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.