1
I have in my root directory the index.php file and config.php. Inside the root folder of my site I have the pages folder with the home.php, login.php and Register.php files, but when I try to access them only the home.php file loads normally, the others have error in loading.
Error:
Object not found, sir! The requested URL was not found on this server. The link on this page seems to be in error or out of date. Please inform the author of this page about the error.
If you believe you have encountered a problem on the server, please contact the webmaster.
Error 404 192.168.64.2 Apache/2.4.41 (Unix) Openssl/1.1.1d PHP/7.4.3 mod_perl/2.0.8-dev Perl/v5.16.3
Follow the code for verification:
index.php file
<?php
include('config.php');
$url = (isset($_GET['url']) ? $_GET['url'] : 'home');
if (isset($_GET['url']) ? $_GET['url'] : 'home');
if(file_exists('pages/'.$url.'.php')) {
include('pages/'.$url.'.php');
} else {
include('pages/404.php');
}
?>
config.php file
<?php
define('INCLUDE_PATH','http://192.168.64.2/sistema/');
?>
Obs: I’m using shaman
You created a file
.htaccess
to configure Apache?– Wesley Gonçalves
And you’re trying to access with query string or not? Ex: 1.
localhost/?url=login
or 2.localhost/login
.– Wesley Gonçalves
Yes, I have the . htacess file in the root folder. When I access http://192.168.64. 2/system/ it loads home.php normally but when I try to access login.php or Register.php it displays this error. I’ve always done so in windows and it worked, I’m currently using the shaman on Macbook. I don’t know if any configuration has to be made in httpd.conf file.
– Marcos De Barros Azevedo
AllowOverride
in your filehttpd.conf
is set toAll
?AllowOverride All
. If not, switch toAll
and restart the apache.– Wesley Gonçalves
Off-topic: the line of your first
if
ends with;
and therefore itsif
is not serving for nothing. This is one of the reasons that make me use always{ }
. But it’s everyone’s taste ;)– Wesley Gonçalves
I already changed the Allowoverride to All and continues the same error x).
– Marcos De Barros Azevedo
Is the Apache root directory set to the root directory of your site? I mean if you access it like this
192.168.64.2/?url=login
or so192.168.64.2/sistema/?url=login
or otherwise.– Wesley Gonçalves
to access the project in the htdocs folder I have to use the link http://192.168.64. 2/system/, I cannot access the direct root folder by http://192.168.64. 2/, it directs me to http://192.168.64. 2/Dashboard/. I find it strange because it would have to work by localhost:8080, but only works by ip.
– Marcos De Barros Azevedo
Let’s go continue this discussion in chat.
– Wesley Gonçalves
For new visitors here goes to Conclusion of the chat: Possibly it was an Apache configuration. After installing an earlier version of XAMPP, the Urls were re-loaded correctly.
– Wesley Gonçalves