Admin folder in subfolder not working... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Admin folder in subfolder not working... (/showthread.php?tid=74055) |
Admin folder in subfolder not working... - HarrysR - 07-15-2019 Hello guys, Here's the thing. I've created the main application in the subdomain sub.domain.com and i've placed another admin ci application in sub.domain.com/admin/. The problem is that when i'm trying to access the subfolder what i get is a 404 error "not found" page. Here's the .htaccess of the admin application: Code: RewriteEngine On The config.php base_urls: Code: /* And here's the routes.php (note: I've placed the controllers in subfolders): Code: <?php I've searched all over the net and i cant find anything useful.. Thanks... RE: Admin folder in subfolder not working... - php_rocs - 07-15-2019 @HarrysR, Is the CI software in a subdirectory? What happens when you type in domain.com/subdirectory? Subdirectory being where the CI code is. RE: Admin folder in subfolder not working... - HarrysR - 07-15-2019 As i mentioned above yes! It is located in subdirectory.. When i type the subdirectory URL i get a 404 not found page.. RE: Admin folder in subfolder not working... - InsiteFX - 07-15-2019 Did you try adding the RewriteBase to your .htaccess file? Code: RewriteEngine On RE: Admin folder in subfolder not working... - HarrysR - 07-16-2019 (07-15-2019, 04:05 PM)InsiteFX Wrote: Did you try adding the RewriteBase to your .htaccess file? Yes, and i still get the 404 error page! RE: Admin folder in subfolder not working... - php_rocs - 07-16-2019 @HarrysR, I think that your config file is wrong. I think that.... $config['base_url'] = 'https://sub.domain.com/admin/'; should be: $config['base_url'] = 'https://sub.domain.com'; My understanding of subdomains is that when calling the subdomain you use... sub.domain.com and domain.com/admin not sub.domain.com/admin I have a subdomain on one of my accounts and the url links listed above (minus the last one) are the ones I use and they work perfectly. When I type sub.domain.com/admin I get an 404 error message too. RE: Admin folder in subfolder not working... - HarrysR - 07-16-2019 @php_rocs If i do this i get redirected to the main website. I forgot to mention that in my header i have this script, in order to prevent users that are not admins to enter the admin panel and if the user is not logged in to redirect him in homepage... if (!$this->ion_auth->logged_in() && $this->uri->segment(1) !== 'login') { redirect('login'); } elseif($this->ion_auth->logged_in() && !$this->ion_auth->is_admin($this->ion_auth->get_user_id())){ redirect('logout'); } RE: Admin folder in subfolder not working... - php_rocs - 07-16-2019 @HarrysR, It looks like your missing a default condition. What if neither of the conditions are met where should the user be redirected. You have If condition else if condition and no default instead of If condition else if condition else condition (default) |