I created a project locally and tried to upload it to a free hosting service called altervista.org.
If I call the main page it works correctly while if I call another page it gives me http 404 error.
Link to the main page
Link to a secondary page
The code of web.php
Route::get('/', function () {
return view('welcome');
});
Route::get('/firstpage', function () {
return "Hello in firstpage";
});
Can anyone help me?
Laravel doesn't work out of the box on sub folders. In order to get it working as-is, you have to host it on your document root (http://matchreferee.altervista.org/). If that's not possible, you can search on how to host laravel on a sub folder.
Related
I am very a beginner in Laravel
I launch my laravel project on localhost
<http://localhost/ecommerce/public/>
Route::get('/', function () {
return view('welcome');
});
this give me the welcome page
But I want to add about page but it always say "404 Not found"
and that's my code:
Route::get('/about', function () {
return view('about');
});
I made a file in views and called it "about.blade.php"
when I type to view about like this :
Route::get('/', function () {
return view('about');
});
and remove the welcome get, it works and give the about page
but when I put it in get "/about" it always doesn't work, even if I just type "string"
why it can't recognize get "/about"?
You should run the project with php artisan serve in terminal or in the server you have to change document root and remove the public in URL
the reason is the extra public in your url
I have been invited to collaborate on a laravel 7 project and I have been able to set up the project locally on a windows 10 system using wamp server. While reviewing the project, I noticed the plan is to use subdomain routing. I am currently tasked with setting up the blade templates and I want to test the route but I can't get the route to work correctly even though the routes exist. This is what the routes look like
When i try viewing the page for realestate by calling the url like this realestate.localhost:8000 I get the connection error below
The route is inside routes/realestate.php folder and its using a closure
<?php
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return 'Realestate Routes';
});
What is the right way to call the route in my local enviroment on windows?
I'm not sure if your environment is different from mine, but make sure you're accessing via http:// and not https://
I just saw your Route code - it's been a long day, sorry :P
Try reading up on Subdomain routing here.
Your Route should look like this:
Route::domain('realestate.localhost')->group(function () {
Route::get('/', function () {
return 'Hello, world!'
});
// all other routes for realestate.localhost go in here
});
You need to edit your hosts and add redirect to localhost from your subdomain. see https://stackoverflow.com/a/56921347/11775360
I am using Aimeos e-commerce on a Laravel site, I want to change the store route to /shop but I get an the browser doesn't open a page I do it as follows
Route::get('/shop', function () {
return redirect('shop');
})->name('shop');
but when I make on "/" main page it displays perfectly. How to change its route?
Use this in your route/web.php file:
Route::get('/', function () {
return redirect('shop');
});
See https://github.com/aimeos/aimeos/blob/master/routes/web.php
I thought this would be fairly simple, but I'm stumped.
I have a link on my site nav that goes to an aws pdf file and works fine. I'm trying to create a named route that a user could type in and also redirect to that file but I'm getting a 404.
I've tried:
Route::get('Documents', function () {
return redirect()->away('http://s3.aws/documents.pdf');
});
Route::get('Documents', function () {
return redirect()->to('http://s3.aws/documents.pdf');
});
Route::get('Documents', function () {
return redirect('http://s3.aws/documents.pdf');
});
And they all result in 404 when I visit www.mysite.com/Documents
Any ideas?
Just use
return Redirect::to($url);
Read more about laravel redirects here.
I am very new to laravel and I simply don't get how to route properly, am completely lost. The problem is I can only route a view to localhost/public. For example I can't route a view to "localhost/public/something". Am not even sure my urls are correct. If i leave "something.php" empty nothing will show, but if i add some html it shows only the html no views. Am sure am doing it all wrong. So how does one route a view to a page other than "public/".
The routing for index is
Route::get('/', function(){
return View::make('welcome');
});
works okay.
Now how can I achieve the same if do
Route::get('something', function(){
return View::make('welcome');
});
or
Route::get('/something', function(){
return View::make('welcome');
});
So i finally got it to work after so many hours. I deleted my laravel installation and did a new one and the problem is gone. Thanks.
There's nothing wrong with your code but might be for .htaccess
Please try accessing the route via following URL
http://localhost/public/index.php?/something
if it's working, you need to use the alternative .htaccess file provided on Laravel website or see if mod_rewrite is loaded on your Apache.