when I try to open an HTML file through `http://localhost/xampp/htdocs/index.html` it says unable to connect to localhost - html

I have installed XAMPP , there is a htdocs folder and inside it index.html file ,
when I try to open it in my browser through http://localhost/xampp/htdocs/index.html it says
unable to connect to localhost .
what is wrong ?

instead of
http://localhost/xampp/htdocs/index.html
try just
http://localhost/index.html
or if index.html is saved in a folder in htdocs then
http://localhost/<folder-name>/index.html

htdocs is your default document-root directory, so you have to use localhost/index.html to see that html file. In other words, localhost is mapped to xampp/htdocs, so index.html is at localhost itself. You can change the location of document root by modifying httpd.conf and restarting the server.

Start your XAMPP server by using:
{XAMPP}\xampp-control.exe
{XAMPP}\apache_start.bat
Then you have to use the URI http://localhost/index.html because htdocs is the document root of the Apache server.
If you're getting redirected to http://localhost/xampp/*, then index.php located in the htdocs folder is the problem because index.php files have a higher priority than index.html files.
You could temporarily rename index.php.

You need to start your Apache Server normally you should have an xampp icon in the info-section from the taskbar, with this tool you can start the apache server as wel as the mysql database (if you need it)

All created by user files saved in C:\xampp\htdocs directory by default,
so no need to type the default path in a browser window, just type
http://localhost/yourfilename.php or http://localhost/yourfoldername/yourfilename.php this will show you the content of your new page.

You should simply create your own folder in htdocs and save your .html and .php files in it. An example is create a folder called myNewFolder directly in htdocs. Don't put it in index.html. Then save all your.html and .php files in it like this-> "localhost/myNewFolder/myFilename.html" or "localhost/myNewFolder/myFilename.php"
I hope this helps.

I just put an index.html file in /htdocs and type in http://127.0.0.1/index.html - and up comes the html.
Add a folder "named Forum" and type in 127.0.0.1/forum/???.???

Related

how do i open the index.html file instead of the file directory in a folder?

how do I get the index.html file to open when you go to file:///C:/Users/ONT%20Studios/Downloads/test/ i.e. can I make it so it doesn't show the directories but opens the index.html file?
You've tagged this .htaccess, which is a configuration file format for Apache HTTPD, but you aren't using Apache HTTPD or any other HTTP server.
You are just reading a local directory with your web browser.
Web browsers do not have features to load an index.html instead of showing a directory listing when you point them at a directory.
Use an HTTP server.

Downloading file from ubuntu server through html

I have my domain pointing at a ubuntu server hosted by amazon ws, and I have my index.html file that gets loaded when someone makes a request to my domain, in the same folder of that index.html file I have another file, and I would like to make it possible to download it from my website. How can I achieve that? I tried with an iframe tag, and giving it src="./myfile.jpg" but the server tries to look for it at www.mydomain.com/myfile.jpg and it can't find it there. Can anyone give me any suggestions?
Btw my files are inside /var/www/html folder, which from what I understood is the default folder for public files on ubuntu.

Index.html file is named as parent directory?

I have an contact.html file on the server in public_html.If I Move it into directory named: Contact, & rename it to index.html,does browser's Address bar shows it like: example.com/Contact/ ? I mean the name of file doesn't show up.
ANY help is appreciated.
Yes, example.com/Contact/ would work, but only if the server is configured with a default document index.html.
This is standard behaviour for apache web servers.
In your apache config there is a directive called
DirectoryIndex index.html ...
This tells the webserver to serve index.html in the case that a directory call was requested ... ie your example.com/Contact/ [Is a directory].
To change that behaviour you would need to look into change your server config, or adding an .htaccess file that would rewrite the URL to index.html

How to create a website with xampp?

I created this little html file test.html:
<p>It works!</p>
and try to host it with apache. I downloaded and installed XAMPP and started apache. But where to put test.html so i can access it in the browser?
I search now for 30 minutes but can't find anything to start with.
xampp/htdocs folder, this is where index.html takes place.
You can access it via your browser like this: http://localhost/index.html
In order to add/view new files/projects, just add them to htdocs directory and access them via localhost/filename address.
Hope it works :)
In XAMPP root directory you can find 'htdocs' folder. You could create here a new folder for each web that you want to create and put inside your files. You can access in your browswer like:
http://localhost/test.html
http://localhost/NewFolder/test.html

MAMP Pro can't see index /

I'm testing MAMP Pro demo and I created a few wordpress folders in the htdocs of the MAMP folder. Whenever I attempt to launch the WebStart, I get to a web page that tells me MAMP Pro was correctly installed, but whenever I attempt to access the localhost:8888 page, instead of seeing the index of wp instances, I only get this message:
The virtual host was set up successfully.
If you can see this page, your new virtual host was set up successfully. Now, web content can be added and this placeholder page1 should be replaced or deleted.
Server name: localhost
Document root: /Applications/MAMP/htdocs
1 Files: index.php and MAMP-PRO-Logo.png
Any help?
Thanks!
Helo, in my case, the problem was solved by removing index.php and reloading the project folder in htdocs.
Check the folder that the files are in and see if there’s a file in there called ‘index.htm’ or ‘index.html’. Basically, anything like that isn’t ‘index.php’ (that’s the WordPress file). If you find that, then delete the file.
Deleting the file index.php hopefully you'll fix that problem