I set up laravel 5.0 when i call this url http://127.0.0.1/myProject/public/ it show me laravel logo. But when i call http://127.0.0.1/myProject/public/home
It show me 404 page not found error. I also made a new controller hello but it is also same error.
U can use virutal host
Enter your path at documentRoot to public folder in project
and enter your virtual domain
DocumentRoot "C:/xampp/htdocs/testni/public/"
ServerName example.dev
U cant access your hello controller if it use auth midlleware without login
The laravel setup comes with Login and Registration Module in itself. The best way in MVC projects is to setup Virtual Host on your machine (this is not compulsion).
The http://127.0.0.1/myProject/public/home should take you to http://127.0.0.1/myProject/auth/login. Where you will find a Login form (presented by fresh Laravel Installation).
The reason for your problem must be bugs in your installation. Please see the Laravel Documentation(Laracasts) more precisely.
Related
Hello everyone i am new to laravel and i hope someone can help me about my problem. I created a laravel project. After that I import it to cpanel using softaculous. Then, I made some changes base on what i research in the net to avoid showing important file like .env . I created a folder relative to public_html, let say the folder name is 'tamangbilang' where i put almost all of my code except the index.php. Inside my public_html folder, I have another folder named as 'tamangbilang' where my index.php resides. I have followed this instruction https://dev.to/pushpak1300/deploying-laravel7-app-on-shared-hosting-hostinger-31cj the only difference is that I put another folder inside public_html.I also did some changes on the index.php code
require __DIR__.'/../../tamangbilang/vendor/autoload.php';
$app = require_once __DIR__.'/../../tamangbilang/bootstrap/app.php';
Everything is working fine on my login page(my first page) but when I try to login, an error occur.
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
It seems like the connection between routes was lost. I did further testing and I notice that the code is working well only if there is an index.php, before the route in the url. example
http://my-sample-domain.org/tamangbilang/index.php/login
P.S. I don't have access for ssh.
go to bootstrap folder & open cache folder then delete config. after that please check your routes this error basically arises due to routes not found for that go to your project installed on local and write php artisan route: list check if the route is present or not.
I have installed laravel in my root of domain, its working fine. However
I want use one sub directory for other purpose like install admin panel in it. For example I have installed laravel in example.com Now I want install other core PHP admin panel in new sub directory called adminpanel. its like this example.com/adminpanel/
but when I try to access it, its giving me error called page does not redirect correctly. I have read somewhere that I can achieve it if I modify my .httaccess file but I have not much knowlede of it. Let me know if someone can help me for same.
Thanks!
Better option is creating an subdomain for the admin dashboard. Login into your cPanel and create a sub domain adminpanel.example.com set the path to your new folder.
Non cPanal
If you don't have cPanel, You should create vhosts for your subdomain in server config (apache/nginx).
I have a laravel project which I run from my local apache server directory.
The link for accessing this project is
www.localhost/project.dev/public/index.php
And I have a navigation menu
After I have set the APP_URL in .env file to
http://localhost/blog.dev/public/index.php/
I get no problems while navigating through the About and Contact pages in the project but when I access the Home page the browser goes to the
http://localhost/
but not to the
http://localhost/blog.dev/public/index.php/
How can I fix it? Here are my routes:
Route::get('/', 'PagesController#getIndex');
Route::get('about', 'PagesController#getAbout');
Route::get('contact', 'PagesController#getContact');
I think the best way is to setup a vhost in apache. if you want to work like this in your .env set the APP_URL= http://localhost/blog.dev/public/
Run php artisan serve in command line. The laravel buil-in server will active. And you will able to access your laravel application using correct url as like http://localhost:8000 try this and let me know if you have any problem.
I just installed laravel following the instruction on Larvel docs. I chose to use install via composer create project command.
In the routes. php i created a dummy route
Route::get('/', function(){
return 'Front Page';
});
When i access http://localhost/mysite/ It shows directory listing of mysite folder. However when i use http://localhost/mysite/server.php It runs my route closure.
I also tried alternate .htaccess code provided at Laravel's docs but that doesn't work either.
I want to remove the server.php from url.
Thanks in advance for help.
This behavior is expected and this is how Laravel works. The public folder is meant for assets and is also (supposed to be) the webservers root directory.
If you are working on localhost that is not the case and the root directory contains multiple projects.
In order to get rid of public you would have to change virtual host settings.
As mentioned here in the site.
The problem with doing virtual hosts is that other projects in localhost will become inaccessible.
Just starting with Laravel.
I've installed it on my wamp server and setup a virtual host in apache. The standard home controller works fine. I've installed the scaffold bundle and generated a blog according to the description at the bundle's github page. There was no errors.
I've added Route::controller(Controller::detect()); to my routes.php but none seem to be working. I've tried http://laravel.dev/blog/posts/create and http://laravel.dev/blog/post/create. The scaffold created 3 controllers, users.php, blog/posts.php and blog/comments.php.
laravel.dev is a virtual host pointing with D:\wamp\www\laravel\public as DocumentRoot.
What are the possible issues? Where do I start looking?
Dont use Route::controller(Controller::detect()) - its known to be buggy and causes alot of issue.
Just define each controller individually in the routes.
I suspect you might have to include "index.php" (http://laravel.dev/index.php/blog/posts/create) in your URLs for it to work. This is a default option set in Laravel.
If you would like to turn this off for cleaner URLs, set "index" to an empty string in config/application.php.
You can read more about this in the documentation: http://laravel.com/docs/install#cleaner-urls