Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mrkarma4ya's avatar

Routes not working in hosted app

Hello,

My routes work fine on my local machine, but once I upload them in the hosting server, they don't work at all. Only the homepage works.

How can I fix this?

Here's my web.php file:

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::get('/', 'PagesController@index')->name('home');
Route::get('/about', 'PagesController@about')->name('about');
Route::get('/services', 'PagesController@services')->name('services');


Route::resource('/posts', 'PostsController');
Route::resource('/comments', 'CommentsController');
Route::resource('/category', 'CategoryController');


Auth::routes();

Route::get('/dashboard', 'DashboardController@index');

Route::get('posts/{id}/duplicate', 'PostsController@duplicate');
Route::get('/logout', '\App\Http\Controllers\Auth\LoginController@logout');

Route::get('/dashboard/category/create', 'CategoryController@create');
Route::get('/dashboard/category', 'DashboardController@index_category');
Route::get('/dashboard/posts', 'DashboardController@index_posts');

And here's a link to my hosted app: lekham.ushostserver.com

0 likes
3 replies
Braunson's avatar

Check to make sure MOD_REWRITE is enabled on your server..

mrkarma4ya's avatar

Huh, for some reason, when uploading the files on the server, the .htaccess file was not uploaded at all (along with other hidden files like .env). I re-uploaded them, and it's working now, thanks for the help!

Please or to participate in this conversation.