简体   繁体   中英

index.html in aws s3 displaying raw text

The same index.html on laptop shows the web page correctly. aws is showing the text as is, as shown below, without rendering. Following S3 static web site hosting steps. FYI.

<html>
<head>
<title>Testing, Inc.</title>
</head>
<body bgcolor="#EDDD9E">
<h1 align="center">Welcome!</h1>
<p>Welcome to my <strong>first</strong> webpage. I am writing this page using a text editor and plain old html.</p>
<p>By learning html, I'll be able to create web pages like a pro....<br>
which I am of course.</p>
Here's what I've learned:
<ul>
<li>How to use HTML tags</li>
<li>How to use HTML colors</li>
<li>How to create Lists</li>
</ul>
</body>
</html>

Appreciate your help.

If the file's extension is not html/htm or there is no extension on the file, it will set Meta Data / Content-Type to application/octet-stream, you can update it to text/html and it will work.

在此处输入图片说明

For Future if anyone is reading this, if your code is not being rendered and your using windows.

In the folder that you saved your text file go to "view" then "options" click "Change folder and search options".

Then click on the "View" tab and UNCHECK "Hide extensions for know file types".

Thank you seartun and Adrian Mole. Both contritrubted to my issue the root issue is that AWS doesnt register the file as an HTML document. I use a mac, i was using word to save my file with an HTML extension, even though it was an HTML document and AWS metadata stated it was html/text, it was still not rendering properly. Solution for me was to use a text editor application to save my file rather than word, I used submlime text exit, and re-upload forcing the metadata to Text/HTML

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM