Reputation: 76
Any idea how to browse file:///C:/Results/index.html from localhost using a href?
i created the test html file (C:/ser/xampp/htdocs/filter/file.html) and place the link to local page (C:/Results/index.html) and i tired to open that link from (http://localhost/filter/file.html
) it didn't work. But when i tired to open link from (file:///C:/ser/xampp/htdocs/filter/file.html) it worked.
I hope this make sense.
I googled it but didn't find any useful solution. Any idea how to solve this?
Upvotes: 0
Views: 14540
Reputation: 1294
If the path is given like as below and if you access from localhost, it will make a search for a file which is inside htdocs folder
<a href="file:///C:/Results/index.html">Click Here</a>
To access the C:/Results folder, create a VirtualHost for the C:/Results and give that respective ip to the href like below. So that you can access the file from localhost.
<a href="http://192.168.1.4:1003/index.html">Click Here</a>
To create VirtualHost, * Open /etc/apache2/httpd.conf and enter the below lines. Dont delete other lines
<VirtualHost 192.168.1.4:1003>
DocumentRoot "file:///C:/Results"
</VirtualHost>
* Open /etc/apache2/ports.conf and enter the below lines. Dont delete other lines
Listen 1003
* Restart apache.
Upvotes: 1