This question already has an answer here:
- How do I run a file on localhost? 6 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.
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 ?
来源:https://stackoverflow.com/questions/313093/ppening-an-html-file-on-localhost-in-xammp-apache-2-2-using-subdirectories-under