davy_yg's avatar
Level 27

Keeps going to http://localhost/dashboard

I wonder about one thing: when I am trying to check my admin place:

http://localhost/soulfy_repo/public_html/admin

it starts to carries me to http://localhost/dashboard

I wonder why?

routes.php

Route::get('/', [
'as' => 'index', 'uses' => 'HomeController@getHome']);

Route::get('/admin', [
'as' => 'admin', 'uses' => 'HomeController@getAdmin'
 ]);

Controllers/HomeControllers.php

public function getAdmin()
{
    $domain = $_SERVER['SERVER_NAME'];
    $user = User::where('domain', $domain)->first();

    if (Auth::check()) {
        $articles = Timeline::where('user_id', $user->id)->where('social_id', $user->id)->where('social', 'article')->orderBy('created_at', 'desc')->get();
    } else {
        $articles = Timeline::where('user_id', $user->id)->where('social_id', $user->id)->where('social', 'article')->where('status', true)->orderBy('created_at', 'desc')->get();
    }

    $settings = Setting::where('user_id', $user->id)->get();
    if ($settings) $settings = $settings[0];

    return view('soulfy.index_v2_admin', ['user' => $user, 'articles' => $articles, 'settings' => $settings]);


    //return view('soulfy.index_v2',compact('user'));
 }
0 likes
2 replies
davy_yg's avatar
Level 27

Someone mention that I need change my .htaccess

Please help.

This is my current .htaccess

 <IfModule mod_rewrite.c>
 <IfModule mod_negotiation.c>
       Options -MultiViews
   </IfModule>

   RewriteEngine On
   
   RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

   # 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]
  </IfModule>
davy_yg's avatar
Level 27

Nevermind, I find the solution.

I comment out:

  # RewriteBase /

Please or to participate in this conversation.