Error in View Route Laravel with Virtual Host XAMPP - php

I'm was change my XAMPP port to 8000 and I open my virtual host with http://laravel.test:8000/
I try to add this to my routes.php :
Route::get('/', function () {
return view('homepage');
});
Route::get('/', function () {
return view('about');
});
but when I'm try to open : http://laravel.test/about:8000/ or http://laravel.test/homepage:8000/ it's error.
How can I open that page with the xampp port changed?

Define your routes properly
Route::get('/', function () {
return view('homepage');
});
http://laravel.test:8000/
Route::get('about', function () {
return view('about');
});
http://laravel.test:8000/about

Related

all routes sends me to welcome blade

those are my routes and all send me to welcome blade; for example, if I try to go to about. blade it end up in welcome blade
Route::group(['prefix' => '{locale}'],function(){
Route::get('/','Room_randring_welcom#index')->name('post')->middleware('setLocale');
});
Route::get('/about', function () {
return view('aboutUs');
});
Route::get('/rooms', function () {
return view('Room');
});
Route::get('/contact','Email_send#contact');
Route::post('/contact','Email_send#Contact_Submit')->name('Contact.submit');
Route::get('/Gallery', function () {
return view('Gallery');
});
Route::get('/room_detail', function () {
return view('room_details');
});

How to redirect to specific URL?

I have a route for tenants name like that:
example.test/TenantNameHere
And I want to make the default of my domain start with the word "site":
example.test/site
My code:
Route::prefix('{tenantName}')->group(function () {
Route::get('/', function ($tenantName) {
return "{$tenantName}";
});
});
Route::prefix('site')->group(function () {
Route::get('price', function () {
return view('welcome');
});
});
Route::redirect('/', 'site', 301);
The problem that I'm facing with this code now is when I open the domain it redirects me to tenantName route, not to the home page that I made!
How can spreate the route of site from TenantName ?
you just have to register your absolute path ('site') first, and "wildcards" routes after, because everything you put in url line now hit the first tenantName route
try this (reverse the order):
Route::redirect('/', '/site', 301);
Route::prefix('site')->group(function () {
Route::get('/', function () {
return view('welcome');
});
});
Route::prefix('{tenantName}')->group(function () {
Route::get('/', function ($tenantName) {
return "{$tenantName}";
});
});
also change "/site/price" path to "/site", so redirect will find correct route

How to get rig of the error Fuction () does not exist in laravel 8x?

Route::namespace('Auth')->group(function () {
Route::get('/login','LoginController#show_login_form')->name('login');
Route::post('/login','LoginController#process_login')->name('login');
Route::get('/register','LoginController#show_signup_form')->name('register');
Route::post('/register','LoginController#process_signup');
Route::post('/logout','LoginController#logout')->name('logout');
});
This is my route in laravel 8x, but it tells me that Fuction () does not exist. What can i do?

Why my routing on the server does not work - with Laravel 6.0?

Normally everything works fine on localhost. When I throw the project to the server, only the homepage works.
When I add manually to this section from the database, I can pull the data.
web site here: http://elsetea.com/public (running)
but when I want to log in to my admin panel from this page (http://elsetea.com/public/login) routing does not work properly and it gives an error.
Why can you think? Please help me. Very Thanks.
Username: admin#admin.com
Password: admin
You can see some routing below.
web.php
Auth:
:routes();
Route::namespace('Frontend')->group(function () {
Route::get('/', 'HomeController#index')->name('home.index');
// Route::get('/home', 'HomeController#index')->name('home');
});
Route::namespace('Frontend')->group(function () {
Route::get('service', 'ServicePageController#index')->name('service-page.index');
});
Route::namespace('Frontend')->group(function () {
Route::get('portfolio', 'PortfolioPageController#index')->name('portfolio-page.index');
Route::get('portfolio/{slug}', 'PortfolioPageController#show')->name('portfolio-page.show');
});
Route::namespace('Frontend')->group(function () {
Route::post('comment', 'CommentController#store')->name('comment.store');
});
Route::namespace('Frontend')->group(function () {
Route::post('contact', 'ContactPageController#store')->name('contact-page.store');
});
Route::namespace('Frontend')->group(function () {
Route::get('aboutus', 'AboutusPageController#index')->name('aboutus-page.index');
});
Route::namespace('Frontend')->group(function () {
Route::get('blog', 'BlogPageController#index')->name('blog-page.index');
Route::get('blog/{slug}', 'BlogPageController#show')->name('blog-page.show');
Route::get('blog/category/{category_name}', 'BlogPageController#category_show')->name('blog-category.show');
});
Route::middleware(['auth.admin'])->group(function () {
Route::get('admin-panel/dashboard', 'HomeController#index')->name('dashboard');
});
Route::namespace('Admin')->middleware(['auth.admin'])->group(function () {
Route::get('admin-panel/profile/edit', 'ProfileController#edit')->name('profile.edit');
Route::put('admin-panel/profile/{id}', 'ProfileController#update')->name('profile.update');
Route::get('admin-panel/profile/change-password', 'ProfileController#change_password_edit')->name('profile.change_password_edit');
Route::put('admin-panel/profile/change-password/update', 'ProfileController#change_password_update')->name('profile.change_password_update');
});
Route::namespace('Admin')->middleware(['auth.admin'])->group(function () {
Route::get('admin-panel/site-info', 'SiteInfoController#create')->name('site-info.create');
Route::post('admin-panel/site-info', 'SiteInfoController#store')->name('site-info.store');
Route::put('admin-panel/site-info/{id}', 'SiteInfoController#update')->name('site-info.update');
});
Route::namespace('Admin')->middleware(['auth.admin'])->group(function () {
Route::get('admin-panel/homepage-version', 'HomepageVersionController#create')->name('homepage-version.create');
Route::post('admin-panel/homepage-version', 'HomepageVersionController#store')->name('homepage-version.store');
Route::put('admin-panel/homepage-version/{id}', 'HomepageVersionController#update')->name('homepage-version.update');
});

SubDomain getting Internal server error in laravel 5.3

i am new to laravel, i managed to deploy my laravel project on godaddy shared hosting, it works perfectly... but the domain doesnt work...
this is the nature of my routes/web.php
<?php
Route::group(['domain' => 'example.com'], function(){
Route::get('/', function () {
return view('welcome');
});
});
Route::group(['domain' => 'cars.example.com'], function(){
Route::get('/', function () {
return view('cars');
});
});
so, whenever i try accessing cars.example.com, it brings the error "500 internal server error"
guys i need your help on this one, thanks
This works for me but I am not using godaddy.
// All subdomain routes
Route::group(['domain' => 'cars.example.com'], function () {
Route::get('/', function () {
return view('cars');
});
});
// All domain routes
Route::get('/', function () {
return view('welcome');
});
If you want to get fancy you could do this.
// Captures all sub domains
Route::group(['domain' => '{subdomain}.example.{tld}'], function () {
Route::get('/', function () {
return view($subdomain);
});
});
// All domain routes
Route::get('/', function () {
return view('welcome');
});

Categories