404 Error (xampp)

Alles, was den Apache betrifft, kann hier besprochen werden.
Urooj Zahra
Posts: 5
Joined: 31. August 2014 23:11
Operating System: windows 8.1

404 Error (xampp)

Post by Urooj Zahra »

Hi ! I'm having this 404 error of object not found. Apache is working fine on my system, whenever i enter "localhost" in URL, xampp page gets loaded but when i further type such as localhost/htdocs/myfirstpage, it gives me an error object not found. I have tried every possible URL with localhost, and this error keeps on coming up.
And when I load file by giving path like file:///C:/xampp/htdocs/series/firstfile/firstfile.php , it loads the complete code on screen, not the output. :cry:
If you could please help me with this.? Thanks
User avatar
Altrea
AF Moderator
Posts: 12055
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: 404 Error (xampp)

Post by Altrea »

Urooj Zahra wrote:when i further type such as localhost/htdocs/myfirstpage, it gives me an error object not found. I have tried every possible URL with localhost, and this error keeps on coming up.
try http://localhost/myfirstpage/
Urooj Zahra wrote:And when I load file by giving path like file:///C:/xampp/htdocs/series/firstfile/firstfile.php , it loads the complete code on screen, not the output. :cry:
for this file the correct URL would be http://localhost/series/firstfile/firstfile.php
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
Urooj Zahra
Posts: 5
Joined: 31. August 2014 23:11
Operating System: windows 8.1

Re: 404 Error (xampp)

Post by Urooj Zahra »

Altrea ! thanks for answering my query, but both of URLs are not working.
This is the 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.

Error 404

localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15
User avatar
Altrea
AF Moderator
Posts: 12055
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: 404 Error (xampp)

Post by Altrea »

I can only help you related to the information you provide (and that is not much).

create a new file C:\xampp\htdocs\testfolder\testfile.php and try to access it by URL http://localhost/testfolder/testfile.php
If this will not work double check if your file is really named with file extension .php and not .php.txt because you used Windows notepad to create your file.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
Urooj Zahra
Posts: 5
Joined: 31. August 2014 23:11
Operating System: windows 8.1

Re: 404 Error (xampp)

Post by Urooj Zahra »

now testfile gets loaded, but it doesn't display the output.. blank screen appears after http://localhost/testfolder/testfile.php
Nobbie
Posts: 13410
Joined: 09. March 2008 13:04

Re: 404 Error (xampp)

Post by Nobbie »

Show us the full contents of testfile.php (probably short / long TAG Problem).
Urooj Zahra
Posts: 5
Joined: 31. August 2014 23:11
Operating System: windows 8.1

Re: 404 Error (xampp)

Post by Urooj Zahra »

i'm just trying to print hello world as:
<? php
echo 'hello world';
?>
it doesn't display anything
Nobbie
Posts: 13410
Joined: 09. March 2008 13:04

Re: 404 Error (xampp)

Post by Nobbie »

<? php
This is a bad error, you have space between "<?" and "php". You MUST NOT have space there. It must be "<?php".
Urooj Zahra
Posts: 5
Joined: 31. August 2014 23:11
Operating System: windows 8.1

Re: 404 Error (xampp)

Post by Urooj Zahra »

Thank you so much mate ! I got it :-)
rubesh
Posts: 2
Joined: 03. August 2015 08:59
Operating System: Windows 8.1

Re: 404 Error (xampp)

Post by rubesh »

Hi,
I have same problem, I am using Xampp 5.6.11
pls help.
i tried the suggestions given above, all the time its saying the same object not found.
Nobbie
Posts: 13410
Joined: 09. March 2008 13:04

Re: 404 Error (xampp)

Post by Nobbie »

Please give us more details:

a) what is the name of your file/script?

b) where did you store it (i.e. full pathname)?

c) what did you enter in your browser in order to call that file?
lankesri
Posts: 2
Joined: 04. November 2015 12:04
Operating System: windows

Re: 404 Error (xampp)

Post by lankesri »

Hi Sir, am i getting 404 error while running my file in server is


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.
Error 404
localhost
Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.5.28
User avatar
Altrea
AF Moderator
Posts: 12055
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: 404 Error (xampp)

Post by Altrea »

The same questions for you
Nobbie wrote:Please give us more details:

a) what is the name of your file/script?

b) where did you store it (i.e. full pathname)?

c) what did you enter in your browser in order to call that file?
Do you guys not read the posts you are replying to?...
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
emilyanncr
Posts: 2
Joined: 16. February 2016 09:05
Operating System: Debian Linux

Re: 404 Error (xampp)

Post by emilyanncr »

Hello, I am currently experiencing this issue. I am running xampp locally on a computer on my same network where I have wordpress installed. To make the site accessible on my other computer I:
gedit /opt/etc/extra/httpd-vhosts.conf
and appended the following to the end of the file:
<VirtualHost :80>
DocumentRoot "/opt/lampp/htdocs/wordpress"
ServerName localhost
</VirtualHost>

then,
gedit /etc/hosts
and added the following line to the end of the file:
##
# Host Database
# localhost is used to configure the loopback interface
##
#...
127.0.0.1 localhost.

On the computer where xampp is running I:
gedit /etc/hosts and added the following to the end of the file
##
# Host Database
# localhost is used to configure the loopback interface
##
#...
192.168.1.191 localhost

So now I'm able to access and navigate through the worpress site just fine barring certain areas such as wp-content , wp-config, wp-settings. When I navigate to those places it's blank even though files exist in those folders. I also have a script in my /lampp/htdocs/wordpress file named 'test.html'. When I navigate to 'localhost/wordpress/test.html' using the other computer on my network, I am met with the following:

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.
Error 404
localhost
Apache/2.4.17 (Unix) OpenSSL/1.0.1q PHP/5.5.30 mod_perl/2.0.8-dev Perl/v5.16.3


Rut roh. I'm not really experienced with the forums so I don't know if I posted this in the right place or what not. Any help is appreciated!!
Nobbie
Posts: 13410
Joined: 09. March 2008 13:04

Re: 404 Error (xampp)

Post by Nobbie »

Oh my god, there are so many errors, its definately incredible.

First of all: no, it is NOT the right forum or do you think "Grundlagen und Wissenswertes" sounds English? You posted into the german board.

Now all the errors:

a) did you read this comment in hosts file:

Code: Select all

# localhost is used to configure the loopback interface
So if you want to define a new host, which should also work from another PC than only the Xampp server, DO NOT USE localhost! localhost is a reserved special name for the loopback device (= the same local PC). Replace localhost in all occurences by another name (you are free to choose any name, but NOT localhost).


b) it looks, as if mixed up what you did on the Xampp PC and/or on the other PC. This line:

Code: Select all

127.0.0.1 localhost.
*should* be on the Xampp server (but you described it vice verse).

and this line

Code: Select all

192.168.1.191 localhost
*should* be on the client PC. Where 192.168.1.191 is the LAN IP from the Xampp Server. Anyway, DO NOT USE localhost (dont forget that!).


c) At next, in the first line you have have dot "." accidently at the end, this is an error:

Code: Select all

127.0.0.1 localhost.
it *should* be without dot:

Code: Select all

127.0.0.1 localhost
and again: DO NOT USE localhost here.


d) The DocumentRoot of your VirtualHost declaration already contains the wordpress folder:

Code: Select all

DocumentRoot "/opt/lampp/htdocs/wordpress"
You may do so, but if you do so, you MUST NOT provide this foldername again in the URL like you did: you entered http://localhost/wordpress/test.html, but this of course does not work, as it finally yields to /opt/lampp/htdocs/wordpress/wordpress/test.html (twice the wordpress folder!). Therefore, either leave out the wordpress folder in the DocumentRoot declaration, OR leave it out in the URL. You MUST NOT provide it twice.


e) Last not least, you should have done all these configurations BEFORE(!) you install wordpress and while installing wordpress, you *should* use the (new) hostname instead of "localhost" during the installation. You will now have the problem, if you call wordpress from another PC via the new hostname (lets call it "xamppserver"), you have to enter either http://xamppserver or http://xamppserver/wordpress (depends on how you declare the DocumentRoot). But as you already installed wordpress on "localhost", some links will point to localhost (especially CSS stylesheets and pictures), but these cannot be resolved correctly, as localhost always points to the local PC (and not the Xampp PC). Thats the reason, why you should not use localhost. You now have to edit wp-config.php and find out, if there are any URLs inside wp-config.php, that contains "localhost", and then replace "localhost" by the new hostname "xamppserver". If you are following these advices correctly, you may succeed and everything should work fine.
Post Reply