XAMPP, Can't access htdocs
Solution 1
DocumentRoot points to the root directory for a given virtual host. So you don't need to append htdocs to the URI if it is already specified in the DocumentRoot. Try:
http://localhost
Also, make sure you restart apache every time you edit a virtualhost/configuration file, since they are only checked/loaded once and that is on server startup.
If you still cannot get it to work, then httpd -S in command line to ensure the respective vhost is correctly loaded.
Solution 2
I think this is a port issue, I faced same kind of issue and I solved it following way
I opened the xampp control panel and clicked on the cofig
button for apache service, opened the first link, Apache(httpd.conf)
- this can be found in xampp\apache\conf
directory also.
Then searched '80
'(without quoatation) and changed them to 81
and saved the file.
Restarted the apache service.
Typed 'localhost:81/project_folder/' in the browser.
Then it worked fine.
Solution 3
I have been facing the same problem of late. It is because I have been including htdocs in the URI but it unnecessary thats why the error occurs.
Try this Working with XAMPP
Under XAMPP root directory there is a folder called htdocs. That is where you should put your web site related stuff. For each web site you create, it is better to create a folder inside htdocs folder and then put content inside that to avoid conflicts.
For an example, you can create a folder called learnphp inside htdocs folder and put welcome.php inside that. Then you can access it via the URL
http://localhost/learnphp/welcome.php.
Hope it helps.
I am Cavic
Mid 30s developer, I enjoy trying out new things. I was told I should be a trainer or a teacher as I explain things in a great way (not my words). Working with Vue JS 2 currently, planning to jump into React soon.
Updated on July 09, 2022Comments
-
I am Cavic almost 2 years
I have problem accessing << localhost/htdocs >>
URLs tried: localhost/htdocs
localhost:80/htdocs
ip:80/htdocs
Always same error
ERROR:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
All services are running correctly I am using port :80
I looked into apache conf :
Here is Doc Root
DocumentRoot: The directory out of which you will serve your documents. By default, all requests are taken from this directory, but symbolic links and aliases may be used to point to other locations.
DocumentRoot "C:/xampp/htdocs"
Please help I can't find the solution..
Thanks
Command Line:
Setting environment for using XAMPP for Windows.
c:\xampp
httpd -S
VirtualHost configuration:
*:443 is a NameVirtualHost
default server www.example.com (C:/xampp/apache/conf/extra/httpd-ssl.co nf:83)
port 443 namevhost www.example.com (C:/xampp/apache/conf/extra/httpd-ss l.conf:83)
port 443 namevhost www.example.com (C:/xampp/apache/conf/extra/httpd-ss l.conf:83)
ServerRoot: "C:/xampp/apache"
Main DocumentRoot: "C:/xampp/htdocs"
Main ErrorLog: "C:/xampp/apache/logs/error.log"
Mutex ssl-cache: using_defaults
Mutex default: dir="C:/xampp/apache/logs/" mechanism=default
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
PidFile: "C:/xampp/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Does that seam correct?
-
I am Cavic over 10 yearsI just tried the -S not sure if the return is what it should be, could you please look I have added it up top?
-
I am Cavic over 10 yearsWelcome to XAMPP for Windows! Congratulations: You have successfully installed XAMPP on this system! Now you can start using Apache and Co. You should first try »Status« on the left navigation to make sure everything works fine. For OpenSSL support please use the test certificate with 127.0.0.1 or localhost Good luck,
-
Rijndael over 10 yearsOk, thats good. Now what exactly do you want to do ? Do you want to see the directory listing ? If yes, then remove or rename index.html
-
I am Cavic over 10 yearsI would like to inside the /xampp/ directory have a new directory called what ever www or example htdocs... Now with in that new folder I want to make folders like "SiteOne", "SiteTwo","WordPress SiteOne"...
-
Rijndael over 10 yearsNavigate to C:/xampp/htdocs - add a new folder called siteone, then in the browser type localhost/siteone and wala.
-
I am Cavic over 10 yearsYes, you are right I was trying to access it wrong ... Such a stupid mistake, as soon as you told me what to look at I did the exact thing you told me in last post and it worked. So I would be able to install WP in that new folder and it should work right? @Rijndael THANKS!