My MAMP web-server works, but serves the full HTML text, un-rendered pages. What did I miss?

James Hancock
James Hancock used Ask the Experts™
I put MAMP server up on my new dev machine OS X 10.15.2

It works, but it only serves it as pure text, not as correctly formatted / rendered HTML, the < > tags don't work.

if I call 'localhost' in the address bar, it lists the files in the localhost  'htmldocs' directory, but 'localhost/index.htm' and it dumps the html text, tags and all.

My HTML is:

This is a title

Open in new window

Did I miss a field / checkbox? in setup?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I looked around for similar problems and missing doctype may be the issue.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
This is a sample web page from's HTML tutorial.

Open in new window

make sure the web server services are running, try using .html extension index.html

You may have used a text editor that formatted the code to text. (TextEdit does that)

I would suggest to use another editor like : Sublime, Atom, Brackets

I highly suggest that you put each project in a seperate folder
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

It has been a while since I have used Mac. I believe you may need to add the htm extension if in fact .html works and .htm does not. This is done in your conf file just as you would on your live server. I found this tut from mamp that shows how to find it easily  File>Edit Template > Apache (or whichever server you are using). For testing like this, it may be best to just stick with .html files anyway unless you are going to use .htm on your site.
David FavorFractional CTO
Distinguished Expert 2018

Likely the problem is your setup is configured in such a way where a MIME type of text/plain is coming back for any file which is not .html, so your .htm (no trailing "l") is treated as plain text, which is correct.

You can try a simple test of renaming the file to .html, then if this fixes the problem you can either...

1) Just use the .html extension on all your files.

2) Did around in your Apache config to enable .htm files to return MIME type of text/html rather than text/plain.

At least, this is my guess about what's happening.

You can tell for sure by running a curl command.

For example, notice the Content-Type MIME type returned for this page...

mac> curl -I -L
HTTP/1.1 200 OK
Date: Fri, 03 Jan 2020 20:44:08 GMT
Server: Apache/2.4.41 (Ubuntu)
Strict-Transport-Security: max-age=63072000; preload
Content-Security-Policy: default-src https:; font-src https: data:; img-src https: data:; script-src https:; style-src https:; report-uri
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer-when-downgrade
X-XSS-Protection: 1; mode=block; report=
Feature-Policy: geolocation 'none'; midi 'none'; camera 'none'; usb 'none'; magnetometer 'none'; accelerometer 'none'; vr 'none'; speaker 'none'; ambient-light-sensor 'none'; gyroscope 'none'; microphone 'none'
Upgrade: h2,h2c
Connection: Upgrade
Last-Modified: Thu, 01 Aug 2019 11:31:47 GMT
Accept-Ranges: bytes
Content-Length: 11685
Vary: Accept-Encoding
Cache-Control: max-age=0, public, no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Edge-Location: YUL
Content-Type: text/html; charset=UTF-8

Open in new window

Likely you'll see text/plain for Content-Type which means unrendered txt.
James HancockSelf Employed



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial