My client recently purchased a linux 1&1 unlimited package from 1and1.com hosting company. I built the application for him in Laravel 4.2 framework. The application is working absolutely fine on my local machine as well as on my own VPS. But when I setup the files on my client host, it looks like .htaccess file is not working. Thats why, the laravel routes are not working and I'm constantly getting the 404 error message when trying to access different routes of the site.
I've researched a lot about this issue and find many people heading with the same issue but couldn't find the real solution to this problem.
Here is the .htaccess code:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I'm using Laravel 4.2
The route is a way of creating a request URL for your application. These URLs do not have to map to specific files on a website, and are both human readable and SEO friendly. In Laravel, routes are created inside the routes folder. They are are created in the web. php file for websites.
To define the routes available in an API, register the API in your routes/api. php file as follows: JsonApi::register('default')->routes(function ($api) { $api->resource('posts'); $api->resource('comments'); }); If you prefer not to use the facade, use app("json-api")->register() instead.
In a Laravel application, you will define your “web” routes in routes/web. php and your “API” routes in routes/api. php. Web routes are those that will be visited by your end users; API routes are those for your API, if you have one.
I encountered the same problem on my 1&1 hosted solution. I suggest adding:
RewriteBase /
that worked for me.
All the best, M
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With