-3

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

jw.dev Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/7.1.1

I am following the PHP tutorial in Laracasts. And on the - Make a router - the 16th episode, after following the up to the middle part, whenever I would run the codes, I would get the "Object not found" error whenever I try to add /about (about.php) on jw.dev (localhost). But if only jw.dev, it is alright. The default index.php will display.

I've tried changing a few settings in httpd.conf but still the same. Followed a couple of instructions here and there but to no avail.

You can take a look on the pic that I've uploaded.

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
R. DRC
  • 1
  • 1
  • 3
  • Here is the link of the pic https://ibb.co/mdaaGQ – R. DRC May 02 '17 at 10:20
  • 404 error => file could not be found. You're probably accessing the wrong URL. Look at the path of your file, and what the root of your public folder is. – Qirel May 02 '17 at 10:20
  • And please include relevant code in the question, not a picture of it. Although, the code directly is irrelevant to the question, as its a matter of hierarchy (structure, paths) of your files and folders. – Qirel May 02 '17 at 10:21
  • check and post virtual host for jw.dev here. – Bagus Tesa May 02 '17 at 10:34
  • In your routes file, where you specify which controller to use for which endpoint, don't put in .php, just the file name without extension. Also, it may be your .htaccess or permissions. – Haring10 May 02 '17 at 10:37
  • @Haring10 Tried removing the .php extension, this is the error: Warning: require(controllers/index): failed to open stream: No such file or directory in C:\xampp\htdocs\php-learning\index.php on line 5 Fatal error: require(): Failed opening required 'controllers/index' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\php-learning\index.php on line 5 – R. DRC May 02 '17 at 11:02
  • @Qirel For the path, the files are located at: C:\xampp\htdocs\php-learning With regards to relevant code, I don't know what to include here. Sorry. I'm new to stackoverflow and php. – R. DRC May 02 '17 at 11:02
  • @BagusTesa Here is for the httpd-vhosts.conf: DocumentRoot "C:/xampp/htdocs/php-learning" ServerName jw.dev – R. DRC May 02 '17 at 11:04
  • did you check to see if `mod_rewrite` is enabled in apache? http://stackoverflow.com/questions/3131236/how-do-you-enable-mod-rewrite – Khalid Dabjan May 02 '17 at 11:07
  • @KhalidDabjan Yes. In fact, it is already enabled when I checked it. I also did the AllowOverride All change. But it is still the same. – R. DRC May 02 '17 at 11:24
  • @R.DRC can you run `tree /F /A` from the root of your project..? looks like something else is at play.. (not the apache, htaccess, or virtual host). – Bagus Tesa May 03 '17 at 00:46
  • @BagusTesa Here is the result: https://ibb.co/gDkLY5 Note: Just don't mind the Request.php and add-name.php files. I continued learning PHP eventhough the code is not running. Those are parts of another episodes. – R. DRC May 03 '17 at 07:26
  • Tried Laragon. Run the app. The same problem. I really don't know what's the problem here. – R. DRC May 05 '17 at 03:31

1 Answers1

0

try adding index.php to your url for once. So i mean something like mysite.com/index.php/about. If this works then you'll know it is a routing problem. If not. It could be a missing file or many other things. Let me know if it works!

Deathstorm
  • 818
  • 11
  • 36
  • If I just add index.php, here is the error: Fatal error: Uncaught Exception: No route defined for this URI. in C:\xampp\htdocs\php-learning\core\Router.php:34 Stack trace: #0 C:\xampp\htdocs\php-learning\index.php(11): Router->direct('index.php') #1 {main} thrown in C:\xampp\htdocs\php-learning\core\Router.php on line 34 – R. DRC May 02 '17 at 14:36
  • If I add index, here 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 jw.dev Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/7.1.1 – R. DRC May 02 '17 at 14:37
  • If I add index.php/about, here is the error: Fatal error: Uncaught Exception: No route defined for this URI. in C:\xampp\htdocs\php-learning\core\Router.php:34 Stack trace: #0 C:\xampp\htdocs\php-learning\index.php(11): Router->direct('index.php/about') #1 {main} thrown in C:\xampp\htdocs\php-learning\core\Router.php on line 34 – R. DRC May 02 '17 at 14:37
  • Oke so we know that it isn't something with the routes. After looking at your screenshots i see that you're not using layout.blade.php or any other .blade.php files wich is actually recommended using laravel. My advice, try again from the start with a new installation. see if this [tutorial](https://laracasts.com/series/laravel-from-scratch-2017/episodes/14) helps you out: Start by episode one. Follow it from step to step. Also i would advice to keep the documentation wich you can find on https://laravel.com/ next to you. – Deathstorm May 02 '17 at 14:46
  • Thank you. Actually, I was already learning Laravel before since it was advised to me to proceed directly to Laravel. Sadly, there were a few things that were not clear to me about Laravel so I paused and proceeded to learning PHP instead. Upon learning PHP, few of the things that were unclear to me then are clear now. With this situation though, I just want to know how to fix things like this for future references. – R. DRC May 02 '17 at 15:06