I have .htaccess file in shared hosting:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
It is working fine foor all routes, except for cms My web.php route file is:
Route::get('/', 'HomeController@index')->name('home');
Route::get('/home', 'HomeController@index');
Route::get('/menu', 'HomeController@menu')->name('menu');
Route::get('/reservation', 'HomeController@reservation')->name('reservation');
Route::get('/gallery', 'HomeController@gallery')->name('gallery');
Route::get('/contact', 'HomeController@contact')->name('contact');
Route::get('/about', 'HomeController@about')->name('about');
Auth::routes();
Route::prefix('admin')->name('admin.')->namespace('Admin')->group(function () {
Auth::routes();
Route::middleware('auth:admin')->group(function () {
Route::get('/', 'AdminController@index')->name('home');
Route::match(array('GET', 'POST'), '/gallery/{gallery?}/{action?}', 'AdminController@gallery')->name('gallery');
Route::match(array('GET', 'POST'), '/{controller}/{action?}/{id?}', 'AdminController@crud')->where('id', '[0-9]+')->name('crud');
});
});
It works well on my local server, but, any url with /admin automatically goes through /public folder in my web server.
My question is how to prevent this from happening using .htaccess?
Edit: It happens only when redirected by auth. eg. if /admin then it redirects to login as /public/admin ALso, I just found out that, I cannot POST anything from cms it gives 403 error. It works fine on localhost.