Laravel 5.1 Pagination URL Error 404 Not Found - php

I am using Laravel 5.1 on WAMP Server 2.5.
And I have this error while working on pagination.
404 Not Found
While I run my site locally using this php artisan serve
php artisan serve --port=212
I run to my site index url http://localhost:212/displays.
The pagination works fine, its pagination link work fine on every page http://localhost:212/displays?page=2.
But when I run it manualy without php artisan serve (http://localhost/bookstore/public/displays), the pagination link goes wrong. The pagination link originally printout http://localhost/bookstore/public/displays/?page=2, but it automatically change into http://localhost/displays?page=2 when the page fully rendered.
Is anyone have same problem like me? Glad if any of you could help.

This is likely because you're meant to set the web root on your server to the public folder (and Laravel assumes that that's the case).
As it is, your web root is set to somewhere two levels above the public folder, so when Laravel tries to redirect to /displays?page=2 it tries to send you to the wrong folder.

Related

Root route displaying blank page while other route works laravel

When i load my application on the root route / it works normally on both local and on testing server. but when i deployed to production. the root route / does not work. But other route seems to work normally. for example, if i open google.com it just displays a blank page but when i open google.com/another it works fine. The application is hosted on digital ocean. What can be the possible cause?
I tried redeploying to see it the was an issue with the deployment, still nothing. I checked the htaccess file, everything looks fine.

No controllers folder in Laravel project

I have downloaded a project from some website. When i run php artisan server it runs successfully shows server has started on 127.0.0.1:8000. When hit localhost:8000 in browser it gives http 500 error. So i checked the storage/logs/laravel.log file its blank, the logs are not going there. I don't know why. Apart from this there is not http folder inside app folder which contains controllers. So I go through the routes/web.php to see which controllers are being used so i found 'RegisterController', 'LoginController' written in routes file. So i searched for these controllers in whole project I found 'RegisterController.stub' inside 'vendor/hesto/multi-auth/src/stubs/Controllers'. I don't know how to run this project. I have attached the screenshot of app directory.

why is Blade code getting rendered on the page?

I just started learning Laravel, Installed Laravel 7.6.2, and PHP 7.4.4
Without modifying a single line of code in the entire Laravel project, I try to open the welcome.blade.php, but it doesn't load correctly, the Blade code is displayed on the page as shown in this screenshot.
Can anyone help me know the reason for this problem and how to fix it?
The next screenshots include the welcome.blade.php code
1, 2, and 3
How are you accessing blade file ?
doesn't seem like you are accessing it via route
Steps:
open terminal/cmd
goto your project directory
run php artisan serve
Open browser and type in http://localhost:8000
After these steps you will see the welcome.blade.php rendered in your browser
Note:
You need xamp / wamp to get apache service on your localhost
The reason why blade is because .blade.php is the template engine for laravel thus enable it writing of notation # with if statement

Why are all my routes displaying a 404 page?

I am working locally on a webpage in laravel with wamp, everything is going smoothly except that my routes are not working I have watched youtube videos and exactly followed their instructions
Route::get('/',function(){
return view ('client-side');
});
this is returning a 404 page
also I have tried returning a simple echo with this code
Route::get('/hello', function()
{
echo 'hello man'
});
And this also returns a 404 page, I dont understand why this isnt working, ty in advance
You said you were working locally with WAMP. But you were not specific about how you were trying to access your website. So, I am wondering if you need to add public to the end of your URL. See, Laravel reads from the public directory. If you are using WAMP, then most likely you haven't don't have it reading from public.
So, let me give you an example. If you are using myWebSite as your directory from your WAMP directory, if you haven't set your hosts files, etc., then you would need to access your website like this http://localhost/myWebSite/public. Make sense?
Another way of accessing your website would be to use the built in web server. From a terminal window in the root directory of your project, type php artisan serve in the terminal window. You should then get a message that says "Laravel development server started: http://127.0.0.1:8000" so then you should be able to access your website at http://127.0.0.1:8000
Probably your problem is in calling url.
Image that your project in htdocs.So you should call your page likethis:
localhost/{YourProjectFolderName}/public/{route}
If you want remove public from url you should cut its content and past it in previous path and edit index.php file.
If you want remove {YourProjectFolderName} from your url you should edit config of wampp.

Laravel 5.2 - Staging to Live Server : 500 Internal Server Error

I have a Laravel 5.2 project working fine locally, after uploading to a live server I have a 'laravel' folder in my root directory and public folder under 'public_html/testsite'
My 'index.php' points to the correct '/bootstrap/autoload.php' and '/bootstrap/app.php'
Upon going to my 'url/testsite/' I get a blank page only (was working fine L5.0) firebug shows : 500 Internal Server Error with HTML : Reload the page to get source for...
index.php is loading by testing with die() before any 'require' methods, but after 'require... autoload.php' the die() is not working, however it is successfully calling autoload.php as a die() works within this file.
I'm not sure if this is a .htaccess issue, or maybe I had to set something up in cPanel last time for this folder (I can't remember). I'd appreciate any help!
Please note this Laravel project sits as a test site in a /testsite/ folder along with my current live site files.
Amongst changing many things at once, I appeared to have solved this by setting up a subdomain within cPanel and setting this to my testsite/ folder.
This was on a server with my current website live under public_html/ and setting up a test laravel app(website) with under public_html/testsite/ to work as an independent site for testing.
The typical "change permissions on storage folder" suggested elsewhere on stackoverflow did not solve my issue so hopefully this helps someone in the same boat.

Categories