-->

Ppening an HTML file on localhost in XAMMP/apache

2019-02-19 05:47发布

问题:

This question already has an answer here:

  • How do I run a file on localhost? 5 answers

I have a site directory for html (dreamweaver CSS3) with lots of subdirectories that contain HTML files for a number of drop down menus. They work fine where they are, but they all have menus that are JavaScript and could be kept in a separate file. So, I want to use Include. I don't want to have to FTP my files to HostGator every time I want to test the includes. I want to have this on my local machine. So, I am attempting for the first time to setup XAMMP and then run my html files (site) on localhost, so I can see what they look like before ftping everything to HostGator and putting it live.

I tried copying the main site folder to htdocs, and then copying the path to the file I want to run in front of the localhost in Firefox, but it gave me file not found: http://localhost/xampp/PL_20080923/0-Sections/000-ComingSoon/PHPTestComingSoonNMBT-Test.html

Do I have too many subdirectories? Why isn't the file being found? It is there.

Tried this too: http://localhost/xampp/htdocs/PL_20080923/0-Sections/000-ComingSoon/PHPTestComingSoonNMBT-Test.html

No go.

回答1:

http://localhost/ should be equivalent to xampp/htdocs/ (i.e. the same files should be accessible but served by the webserver.) This is the document root. So for example on a normal windows xampp installation http://localhost/index.html should serve c:\xampp\htdocs\index.html.

Did you try http://localhost/PL_20080923/0-Sections/000-ComingSoon/PHPTestComingSoonNMBT-Test.html ?