Routes not working without index.php in laravel 4.2 - php

I have spent a considerable amount of time googling for suggestions for this, and despite setting up several test project in Laravel 4.2 before on xampp server.
I am not sure what I am missing in this project...
I have one more project on server and it is working fine But when I tried to start this new project I started getting this error.
XAMPP version 5.6.3
PHP version 5.6.3
This is my .htaccess file :
RewriteEngine on
Options -MultiViews
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
This is my Routes.php file :
Route::get('/admin', function(){
echo 'hello';
});
My url is :
http://localhost/adminpanel/public/admin
And showing this error :
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
When I write this url : http://localhost/adminpanel/public/index.php/admin Now works fine..

Try this htaccess on your public folder
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Related

Laravel project links not working on heroku

I was given a laravel project I need to get up and running. I am new to laravel, but after allot of work, I believe I got everything configured properly and I deployed the project to heroku.
When I do artisan serve on my guest machine in my laravel project and go to the given url everything works fine all the links works.
But I deploy it to heroku and my index page shows but none of the links work.
I get:
Not Found The requested URL /register was not found on this server.
It seems that running php artisan serve kinda activates the links, but how do I make that happen on heroku???
I should note the app is using blade.php files
What am I missing???
This is in the /resources/views
My _htaccess inside my public folder is as follows
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
I tried adding RewriteBase / doesnt help.
I also tried changing htaccess to:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Don't work admin-panel and authorization in laravel5.3's project

I make admin-panel at laravel 5.3. I try to install sleepingowl 4. All project I make according to the official documentation.All project operate as expected (http://blog.laravel/). But...if I go the link
http://blog.laravel/admin
than apache issues :
Not Found
The requested URL /admin was not found on this server.
After I try to use authorization. I make new project which named "auth". But ... if I go the link:
http://auth/signup
apache issues too...:
Not Found
The requested URL /signup was not found on this server.
All rights are open to write-rewrite. All my steps according of the oficcial documentation :
https://laravel.com/docs/5.3/installation
I don't know what I doing wrong. Please, tell me what can I do
There are the links of github:
https://github.com/AlexBukreyev/blog.laravel - this is my project, where I make admin-panel.
https://github.com/AlexBukreyev/auth - this is project of authorization
file public /.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Make sure in public directory, there is a file called .htaccess (with the dot . at the begining). The content of that file should look like this:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
It turned out, it was in the settings of the Apache! You need to connect mod_rewrite through the console:
apache2ctl -M | grep -i rew
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

Laravel url parameter returning 404 once hosted

I'm developing a Laravel website. Everything is working fine on localhost. But once hosted online with 1&1, when I add a parameter in the route, it's returning an error 404 (not found).
In 1&1 the root url is redirecting to the file "public" of my laravel project.
And the .htaccess in this public file looks like that :
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Does someone know what could be the problem ?
Try running the following artisan commands on your host:
php artisan optimize
php artisan route:clear
If you don't have access to run these commands, you can call them in code using Artisan::call('optimize') etc.

Laravel on Plesk Routing Issue

I can't access my routes when I uploaded my site on Plesk. I get 404 error
I am using Laravel Version 4.2
I made the default directory to httpdocs/public/
Here's my .htaccess file in public folder.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Please help.

why show NotFoundHttpException

I have install a fresh copy of laravel 4.2
When i visite home route (localhost/public/) it work fine but when i visit other route as like "localhost/public/kk" it show NotFoundHttpException.
here is my route.php file
<?php
Route::get('/',function(){
return View::make('hello');
});
Route::get('/kk',function(){
return View::make('hello');
});
here is .htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
The entry point for all requests to a Laravel application is the public/index.php, therefore it would be available here --> localhost/public/index.php/kk
for further info you can go to this link.
First check if you have enabled the mod_rewrite module.
Then.. according to the documentation you should try an alternative .htaccess if the .htaccess that ships with Laravel does not work.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Edit: Enable mod_rewrite in xampp

Categories