How to get address of a file on localhost? - html

I am trying to open a HTML file using localhost method.
Below are the two images. The URL shown there is generated
automatically by an extension.
Now, I want to find the same for any other file or folder on my PC (manually) how to do that ?

Related

apache2 not serving css file despite showing file in directory

I have a website I am trying to host, but for whatever reason, apache2 is refusing to serve the css file I have for my website. I have not change any settings and everything is completely default. I installed apache in the past 2 weeks so everything is clean and fresh.
All I did was copy all the files generated by jekyll from the _site folder and put them into /var/www/html on my server. now, when I go to my website, I can see all the content and the html loads correctly. The links work, images work. but there is no css styling available.
Because the default settings on apache arent that good, i can browse the folder contents. for example, my css file is store in /var/www/html/assets/css/style.css. So, when I access the website by going to https://mywebsite.com/assets/css, I can see the file structure and apache shows that I have a css file in there. but, when I try and click on that file, I get a
Not Found.
The requested URL was not found on this server.
----
Apache/2.4.52 (Ubuntu) Server at xxxx.com Port 443
All other files can be browsed in the folder structure and every file appears to be present, its just the pesky css file that will not load.

how to redirect ip:port to ip:port/html?

So I have this VScode folder that I run onto live server extension. However, whenever I open this ip:port, I always see my other code that is used in the html file. Is there a way that I can automatically go from ip:port to ip:port:html instead of seeing the entire folder selection?

Image not showing in browser on local server (Live server extension) but shows when opened from explorer

I am having problem in HTML . My Image is not showing in browser (Firefox) when html file is opened through live server extension (VS code).It throws a Security error that html file can't link to image. I want to use image as background.
My html file is folder in D: drive.
Path = D:/myhtml/index.html
And my image is in F: drive
Path = F:/mountain.png
my img tag is
<img src="f:/mountain.png" alt="mountain"/>
But when I open html file directly from file explorer image shows up.
Please help to solve this problem.
Live server in made to behave like a real web server (one that is online on the web, called via http(s), and does not have access to your local hard drive file system "the Windows way" with F: etc.
Going to F:// is only possible on your own machine and will never work online. Browsers have built in a way for you to browse your local files like that. Web servers don't have this feature.
Use HTML file paths, meant for the web server:
Absolute path: https://example.com/images/mountain.png (path to an online destination which could be another domain than yours)
Relative path: images/mountain.png (relative to where your html file is located on your own web server)
Relative path to a folder outside of where your html is located: ../../etc/images/mountain.png

How to get the all the files(their file paths) in a folder from a web directory?

I'm trying to make a UWP file browser app that show all the files from http://192.168.201.254/media/, to do that I need to get all the file paths under http://192.168.201.254/media/, is there a way to do it?
Clients can only request known file URLs via HTTP.
The server can be configured to spit out an HTML file list as default page for the directory and you can process that on the client side.

html showing contents of folder

i am creating a web page to show the contents of a folder so that people can view the files and download them if needed.
Click here to view Folder
But i wanna do this without any coding what so ever, i found this code which lets me view files.
The problem i am facing is that when i double click the html page and open it this hyperlink works and i get what i need but when i access the page through a server (IIS 7) then the hyperlink does nothing ?
am i to set some permissions or what ?
can someone tell me what im doing wrong ?
The link will work when the file you want to download is on your own personal computer, which in your case is true if you're just showing the HTML file locally. It won't be true for users visiting your website from another computer though.
If you want to serve the file on a server, you need to link to the path on the server itself, that is, if the file is in C:\inetpub\wwwroot\test_pages, your A HREF looks like this:
Click here to view Folder
Offcourse, this will work for simple files. For folders, you need to enable the webserver to show directory contents by enabling Directory Browsing.
There are security implications of linking to a local file from an online source. It works when the page is held locally but when on a server it puts a stop to it.
You can also use linux build-in command Tree, in example below you can see that i only want to add files that are matching .tar.gz or .zip or .tar.bz2
tree -P "*.tar.gz|*.zip|*.tar.bz2" -h -D --dirsfirst -r -H . > index.html;
You can also add a custom css to the page for a better looking output.
Straighforward and highly secure since the result is only html
as you use windows you can use www.cygwin.com to emulate a linux environement