Can't access some pages without index.php on server - laravel

Ive just uploaded to the server and have encountered the problem that i can only see my home page unless i add www.site.com/index.php/ (index.php) after the url. Is this a frequent error for laravel and what is the fix?

Laravel not call url *.php , *.html
you can call index.blade.php from route
routes/web.php
Route::get('/', function () {
return view('index');
});

Related

Laravel handle routes in case of subdomain and main domain

I'm using Laravel routing subdomains to handle all subdomains. It works fine for the subdomain, but when I customize the routes for the primary domain routes is overwritten I think it because the route names are fixed for both subdomain and main domain so what is the proper way to handle this issue?
This is what is in my routes file at present;
Route::domain('{company}.' . config('app.url'))->group(function () {
include "allRoutes.php";
});
Route::domain(config('app.url'))->group(function() {
include "allRoutes.php";
});
[enter image description here][1]
here is part of the content of the allRoutes.php file
[1]: https://i.stack.imgur.com/Bzm0F.png
From your question, it looks as though you're having trouble when referencing routes because they are using the same name.
You should provide a name for your domained routes which effectively namespaces the naming.
Route::domain('{company}.' . config('app.url'))->name('sub.')->group(function () {
Route::get('/', 'HomeController#index')->name('home');
});
Route::domain(config('app.url'))->name('main.')->group(function() {
Route::get('/', 'HomeController#index')->name('home');
});
Then later when referencing these you'll be able to use
route('sub.home', ['company']) for the subdomain route and
route('main.home') for the main domain

Route /admin trying to load main page on server

So I just pulled my code to this linux server and after some testing realized the /admin route was somehow trying to load the main page, which is weird since on my test server (Windows) it's working well.
The structure of /public looks like this:,
/public
/site
/admin
With the assets for each part of the website inside it's folder.
Console shows a lot of errors related to JS and CSS paths like this:
http://myip/admin/site/js/popper.min.js which is curious because the proper path would be http://myip/admin/js/popper.min.js.
I tried to change the /admin route to change the route behavior to redirect but it looks like nothing has changed, the route seems to take no action.
Here's my routes file:
// Site
Route::get('/', 'SliderController#showSlider'); // Show Sliders
Route::redirect('/admin', '/login');
// AutenticaĆ§Ć£o
Auth::routes();
Route::group(['middleware' => 'auth'], function () {
// Admin
Route::get('/admin', 'HomeController#index')->name('admin');
// Sliders
Route::get('/sliders', 'SliderController#listSlider'); // List Sliders
Route::post('/sliders/new', 'SliderController#createSlider'); // New Slider
Route::get('/sliders/edit/{id}', ['as' => '/sliders/edit/', 'uses' => 'SliderController#editSlider']); // Edit Slider
// Slides
Route::post('/slides/create/', 'SlideController#createSlide'); // Create Slide
Route::post('/slides/update', 'SlideController#updateSlide'); // Update Slide
Route::post('/slides/delete/', 'SlideController#deleteSlide'); // Delete Slide
});
If I try to go to /login it works well, loads all the style and js files (which are on the same folder as /admin files), it actually works 100% well.
It should redirect from /admin to /login if the user is not authenticated, but again this /admin route have no action, not even a 404 error, it just tries to load again the main page, which leads to css and js erros because of wrong path for these assets.
This only happens on Linux so I have no clue what's happening.
You could be having conflicts with your 'admin' route and your 'admin' public directory, try changing either one of those.

Laravel 5.4 not found error for existing route

I am receiving a not found error for an existing laravel route
web.php:
Route::group(['middleware' => 'admin'], function () {
Route::get('/admin', 'AdminPageController#home')->name('admin-home');});
And when I try to access '/admin' in the url it says that it is not found, but all other routes were working fine.
I figured out the problem
It was that in the /public folder I had an /admin folder in which I placed my assets for the admin part of the site. I removed it and placed my assets inside /css/admin folder instead of /admin/css and the error was gone.

How to link a HTML page to a button in Laravel 5.1. I am new to PHP very new to Laravel and this community

I am trying to link a separate signup page with the signup button using laravel, it's showing:
NotFoundHttpException in RouteCollection.php line 161:error
The page resides in the resources/views folder. And the html in in resources/views/includes.
http/routes.php
Route::get('/register', 'HomeController#getRegister');
Controllers/HomeController.php
public function getRegister()
{
return view('admin.register');
}
The URL of your sign-up page is not added in the routes.php file, add it in the file as:
Route::get('/signup','yourController#sign_up_function');
got answer to my problem.
The routes.php should have:
Route::get('/signup', function () {return view('actions.firstsignup');})->name('firstsignup');
here '/signup' is the http identity for the page. 'actions' is the sub-folder in views where the destination file is stored, file-name is firstsignup.blade.php and ->name('firstsignup') is route definition.
Now I have put link in the button as:
href="{{route('firstsignup')}}
Thanks a lot guys for helping me clearing it conceptually.

I have weird behaviour in laravel 5 it redirects me to root when put customers in url

I have weird behaviour in laravel 5, it redirects me to root when put customers in url.
like this:
localhost:8080/easy_marketing/public/customers
it redirects me to
http://localhost:8080/customers
also,
when use words like those: customers_, customer, _customers they worked fine.
another links like
localhost:8080/easy_marketing/public/groups
localhost:8080/easy_marketing/public/keywords
they are working fine.
routes.php
Route::get('/', 'WelcomeController#index');
Route::get('home', 'HomeController#index');
Route::group(['middleware' => 'client'],
function() {
Route::get('customers', 'users\CustomersController#index');
Route::get('customers/import', 'users\CustomersController#import');
Route::post('customers/run-import', 'users\CustomersController#runImport');
});
Routes cannot have the same name as any folders in your public directory.
Laravel will redirect to the root if you try to access a route when you have a folder with the same name in your public folder.
Credit to user #Lazirro for his answer here: Laravel slash after url redirects to root folder
I re-name customers folder in public folder and the link is working ok.

Resources