Routes not working after deploying Laravel 5 project into hosting - laravel-5

I just uploaded my Laravel 5 proyect to the hosting server. The index page almost works, but every link is broken. Every single route returns an Internal Server Error message.
This is the actual message:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, and inform them of the time
the error occurred, and anything you might have done that may have
caused the error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
I already set storage folder permissions to 777, but I don't even get an error log.
Any suggestions?

In the end I could solve it adding
RewriteBase /
to my .htaccess file in the public folder.
This is my complete .htaccess file:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
The most strange thing is I already had tried that, because that's how I solved the same issue with Laravel 4. What made it work was changing
RewriteBase /
to the incorrect
RewriteBase ../
and then changing it back to
RewriteBase /
And misteriously it solved.
I hope this helps anyone. It's 5:22 and I need some sleep

First make sure .htaccess file exists in your public_html directory. Most uploads via zip on linux server will not automatically copy the .htaccess file since it is hidden.

You will encounter this problem if you missing the .htaccess in public_html which is not included if you compres the project to .zip or others.

Related

Laravel website 'uploaded on shared hosting' is showing directory structure instead of my specified web routes

I've uploaded the project on a shared hosting and it is showing the complete directory structure of the project.
I've searched for the solutions and changed my .htaccess file. This is my .htaccess file now:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
but it is still showing the same directory structure. Any help would be highly appreciated.
Laravel is not designed to be run on shared hosting. You'll have to manually change its structure to run it on shared hosting.
Follow this article: https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e
Though I will recommend to buy a private server for laravel.

Magento 404 front end on Multi Site after moving server

We have recently moved a Magento multi site environment to a new dedicated server, however all the sites apart from the admin URL site (not used apart from admin are) are reporting Magento style 404 pages on the front end.
We have ensured mod_rewrite is turned on, checked the database and manually amended the URLs in PHPMyAdmin to assign some temporary test URLs. The URL assigned to the admin area works fine, and the rest resolve to the server, however every front end is still 404. We have tried adding in index.php to the URL, no change. Checked all file and folder permissions, all OK. Cleared all cache manually and reindexed from command line. No change.
We have checked HTACCESS is correct which it looks to be. We have even taken another backup of the database and full site and restored to another server with the same issues.
We have also tried disabling SEO urls/URL Rewrites without change too.
Error logs dont say a lot either which isnt helpful.
Really struggling with this now so any help or pointers greatly appreciated. Thanks
First Solution:
Replace current .htaccess file with the default .htaccess file from Magento.
Second Solution:
#fastcgi_param MAGE_RUN_CODE default;
If doesn't work, try following solution:
Third Solution:
Is this installed on an Apache webserver? If not, the .htaccess functions will need to be translated to your flavor of web server software.
Has DSO module for mod_rewrite been installed in Apache and been enabled to load?
Is AllowOverrides enabled for the virtual server so Options +FollowSymLinks will function? You may have to check with your hosting service provider and have it enabled.
Is Magento's .htaccess file available in the doc root folder?
Has the rewrite engine been turned on in the .htaccess file?
Has the proper RewriteBase been assigned in the .htaccess file?
General entries in Magento's .htaccess that must function so rewrites will function to eliminate the need for index.php to appear in the URL.
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
#RewriteBase /magento/
############################################
## workaround for HTTP authorization
## in CGI environment
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
############################################
## always send 404 on missing files in these folders
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
############################################
## rewrite everything else to index.php
RewriteRule .* index.php [L]
</IfModule>
Third solution from Fiasco Labs

How to remove index.php file from codeigniter

I referred the CodeIgniter Site and also checked various sites for information on how to remove index.php file from Mac OS X 10.10. But still index.php is unavoidable. I need steps to remove index.php from CodeIgniter on Mac OS 10.10.
This is working:
localhost/jenny/Learn/index.php/about
This is not working:
localhost/jenny/Learn/about
As long as you are running apache the operating system should not make a difference in this case.
You need to create a .htaccess file within the your root web directory (this is the directory where the index.php file is located) and within the .htaccess file you will want to include the following:
RewriteEngine On
RewriteOptions inherit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
This will allow you to utilize the second url you have posted as it will determine if the requested resource is located within the webroot and if not then redirect to the index.php file without it needing to be included in the url.
If you are not running a different web server then the rewrite rule will be different but the principle is the same. Send all requests to index.php if not resource does not live in web root.
open path:/application/config/config.php
find : $config['index_page']='index.php'
replace : $config['index_page']=''

Object not found error 404 in codeigniter

i have some problem when i try to open another controller
http://localhost/ci/dashboard
getting error like this:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19
link sourcecode: sourcecode
If you Using WAMP server then open "httpd.conf" file, search "LoadModule rewrite_module modules/mod_rewrite.so" and remove # which in the start of the same line..
and restart your WAMP Server
Then add this code to your .htaccess file which is in the codeigniter folder (if not create it in the folder's root):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
check first if apache is already way or not
and may try to open localhost port problem
and usually when in the ci enksripsi effect to open a web page

Netbeans still showing root folder

I'm starting a new Codeigniter project inside of Netbeans 7.3.1 and have the following set up for my file structure.
I have in the project properties set up as the web root is pointed to public_html inside of the text box. I also have this for my htaccess file as well as I have removed index.php from the ci config file.
My problem is that when I go to localhost/MyProject it still shows the foot folder and I don't know why.
Is there anyone that sees a mistake I have made somewhere.
-root
-application
-system
-public_html
-assets
.htaccess
index.php
Options -Indexes
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
#When your application folder isn't in the system folder
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
Out of the box Netbeans doesn't come with CodeIgniter support, but that can easily be solved by installing the appropriate plugin:
https://kenai.com/projects/nbphpci/pages/Home
Due to the specific structure of a CodeIgniter project telling Netbeans that a CodeIgniter project is just another php project won't work correctly.
The detailed procedure to install this plugin can be found on their Wiki or here. Usage is explained here.
I think that you will have to restart a new project and properly activate CodeIgniter support in the project setup wizard, and that should be it.

Resources