Html files don't work properly while using them locally?

Hi,

I have tried to use a program called Publii to make a blog it generates static html and css files that you then send up to a server but the file paths for the files are all messed up I tried it with even a super basic html file I made in a text editor and it cant even display an image because the file path is a bunch of gibberish but when I send it to the server it works fine.

For example this is a file path for a html file in a folder in my documents folder:

file:///run/user/1000/doc/f94de79/index.html

I don’t understand why the file path is so strange? I am new to Linux I am using Brave browser not Firefox the default Firefox will display it but when generating a more complex site through Publii the files don’t work on the web server.

Please help.

Thanks.

Welcome to fedora @jjes94

You have to use a webserver locally and then watch the site in the browser. You can try this:

# Open terminal and change to the folder where your index.html file is and use the command below.

python3 -m http.server

Change to your Webbrowser and type the following address :

http://127.0.0.1:8000/

p.s.
On the web-server you are using a relative path while displaying it the browser. You see this on the url. The first foward slash is the root folder from your webspace which contains the index file. Like localhost:8000/

Thats why you have to run the command above where the index file is.
If this are rudimentary websites you make them in a specific folder you like and then se the same structure up to you web-space.

More info’s about the web.server command:

2 Likes

See also: What in the world is /run/user/1000/doc?

1 Like

Thanks this works for the basic html I am still trying to figure it out for Publii if I sort it I’ll post solution in thread I know there are others having this issue with Publii because I have done a lot of web searching before coming to this forum.

1 Like