For some reason when I reference CSS files or image files in the hostgator index file (under public_html) they just don’t work, but it works when I test it locally. Here is an example of me trying to use an image uploaded to the public_html folder via cPanel:
<!DOCTYPE html>
<html>
<head>
<title>mydomain.com</title>
</head>
<h1>Here is an image</h1>
<img src="public_html/me.JPG" alt="pic of me">
<p style="background-color:#ECEBE9;">Here is more text
</p>
</body>
</html>
I have tried:
- Changing the permissions (everything in public_html is 755 and
public_html is 750 as per hostgator’s instructions) - Using the full path: "/home/username/public_html/" (using my username and also trying "home3" instead of "home")
- Putting the JPG in a subfolder called images and using that path name
I’m assuming it’s something obvious regarding the path, but I really don’t understand why the index.html file can’t access CSS or image files from the same folder on hostgator so please let me know anything else to try.
2
Answers
if me.JPG is on the same folder that html doc, use src="me.JPG"
Use relative paths instead of absolute paths.