I added this to my routes
Route::get('account/create',array(
'as' => 'account-create',
'uses' => 'AccountController#createGet'
));
then when i go to public/account/create , i got a
The requested URL /webproj/public/account/create was not found on this server error.
Then when I tried it to my /webproj/server.php it works.
You have some problems:
1) If you still need to use /public in your URL, the correct form would is:
http://server/project/public/index.php/account/create
2) You should not be using /public, so you need correctly configure your webserver virtual hosts, to point directly to /public so you can just access your urls as
http://server/project/account/create
3) /webproj/server.php should not be accessible and should not be used, Laravel needs it only for running
php artisan serve
Related
I am using Laravel 9 and I am deploying my web in a windows VPC with IIS server. How do I change my named route variable to my domain, without the port.
Here is my route web.php
Route::get('/register', [AuthController::class, 'register_view'])->name('register_view')->middleware(HasToken::class);
In my public view page I use the route in my hyperlinks like this
home.blade.php
Register
The I use the cmd php artisan serve --host="mywebsite.com" --port=3000
*I have to use other port besides 80
Website at my domain load the page perfectly, but my links hrefs are using http://localhost:3000
How do I change this named route settings to be my domain?
I have changed all the constant such as APP_URL in .env to my domain
Have tried using Route::domain("mywebsite.com")->group(function() { /* My routes */ }), but in the web it becomes http://mywebsite.com:3000/routes (it appended my local internal port and also without https), how do I configure this?
Thanks in advance.
I have used Laravel Boilerplate for development of my application. Beside that I have installed L5Modular with it. So i define the route Like following inside my Modules
<?php
Route::group(array('module' => 'test', 'middleware' => ['web','auth'], 'prefix'=>'frontend','namespace' => 'App\Modules\test\Controllers'), function() {
Route::resource('test', 'TestController');
});
But when i tried to access the route http://localhost/blog/public/test/create it's showing 404 Error.
Why my route not accessed? is there any error of defining route?
You need to configure a virtual host to get laravel working, that's quite easy and even easier if you're using any software such as MAMP or XAMPP.
If you're on a MAC I'd suggest to have a look at laravel valet: you'll have your web server running in seconds.
If you don't want to do any of this, you'll have to change a few things in order to get Laravel working in a sub directory.
You might forget to write frontend prefix to URL. Try to access by:
http://localhost/blog/public/frontend/test/create
I have downloaded clients project from the internet, and it is programmed in Laravel (also seen by directory structure). I have set up homestead.yaml, hosts, filled the DB and modified .env. I also did a vagrant provision and 'composer dump-autoload` once everything was done.
Problem I'm facing is that home route '/' returns index.html in root. But route.php says different:
Route::get('/', 'PagesController#home');
Route::get('about', 'PagesController#about');
I've tried to intentionally modify routes so that they point to controller which doesn't exist, deleting some letters inside Kernel.php...anything that would reasonably produce an error, and nothing happens. I still get back what is inside index.html. Also there is index.php which gets returned after I enter anything after slash inside the url:
/bla
/nlo
/xyz
You get the point...what can be the issue?
I have also tried with artisan cache:clear
It's a webserver misconfiguration error. The webserver is configured to serve index.html with more priority than index.php. Relevant configuration can be found at /etc/apache2/httpd.conf, /etc/apache2/sites-available/your-site, .htaccess, or for nginx /etc/nginx/sites-available/your-site just to mention the two most common web servers.
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.
Recently,I just installed a chat package called Easychat. At first, it worked perfectly. I don't why but today I'm facing a problem where It said as in the pic
In the console it also said: Failed to load resource: the server responded with a status of 500 (Internal Server Error)
The weirdest thing is that when I go to Route file and change the URI from easychat to something different like easychat222 just for testing.
From
Route::get('/easychat', [
'as' => 'chatnow',
'uses' => 'EasychatController#getIndex'
]);
To
Route::get('/easychat222', [
'as' => 'chatnow',
'uses' => 'EasychatController#getIndex'
]);
and refresh the page. It works perfectly with the old uri (easychat) not with the new one.
Anybody knows what is the problem here and please tell me how to fix it.
Thank you very much!
You're using wrong web server configuration. You should point web server to a public directory inside Laravel directory and restart it.
Change these lines in Apache config file (if you're using Apache):
For Apache you can use these directives:
DocumentRoot "/path_to_aravel_project/public"
<Directory "/path_to_aravel_project/public">
For nginx:
root /path_to_aravel_project/public;