How to create a website with xampp? - html

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

Related

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.

Developing a simple website from scratch using https://css-tricks.com/app-from-scratch-1-design/

I am following all the steps from beginning. In chapter four there are codes displayed.. I am not getting where to paste those codes in my local pc.. that is in xamp...can anyone help me?
If you are on mac
Copy all your files & paste them into the Applications > XAMPP > htdocs (root folder).
Then Navigate to localhost/index.php
If you are on windows
Copy all your files & paste them into the c:\xampp\htdocs (root folder).
Then Navigate to localhost/index.php from the browser
Note : Before you navigate to the localhost/index.php you have to start the Server.
You need to concentrate on setting up a localhost. BTW, there is a very easy way to set it up if you are using php: Link
So, name your first file to be called as index.php or index.html, and do
php -S localhost:8000 in console from the same directory. After that it should propose you to go to the browser and see your content at http://localhost:8000/

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

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

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/???.???

MAMP htdocs phpinfo

I am trying to get a simple phpinfo() to print out on my local server (using MAMP). I made a new directory in /Applications/MAMP/htdocs (php_sandbox) and put a file in there named my_phpinfo with only phpinfo() in it. How can I view the contents of this file in my web browser?
Is it also advisable if I set the Apache document root to be in my home directory/sites? I will be mainly using this local server to test/host some small sites.
Thanks!
visit in your browser localhost/my_phpinfo/index.php assuming you named the file with
<? phpinfo();?> is in index.php. Also, make sure you are editing the correct php.ini in your MAMP directory by checking your mamp prefs and seeing what version of php MAMP is using.
Your in the right folder by default from what I remember. MAMP runs apache on port 8888 by default. You should be able to go to http://localhost:8888/ You can also get to this page via the control panel (should have a button to open home page). This page will also show you've configured MAMP's Apache to run on a different port.
Whatever you name your file; you'll want to give it a .php extension, so if you file is named my_phpinfo, add a .php so it becomes my_phpinfo.php. Make sure you function called is wrapped in php tags like so
<?php phpinfo(); ?>
If this file is directory in the htdocs folder you should be able to go to http://localhost:8888/my_phpinfo.php and get the PHP Info page.
As far is moving the directory. I normally do. Especially b/c it makes upgrading MAMP a little easier (already have to worry about MySQL). You might have to tweak the file permissions just a bit to make sure it runs correctly. I believe though you should be okay since it is running as your User.