0
votes

On the server, I have created a subdomain where my CodeIgniter 3 code is placed. Its default controller is working whatever my controller path is placed, but there are many posts. The error shows 404 page not found. I've tried multiple solution but not worked for me. my .htaccess file is

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

#ErrorDocument 404 /index.php

Bas url is

defined('BASE_URL') OR define('BASE_URL', (is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/');
$config['base_url'] = BASE_URL;
$config['index_page'] = '';

My Routes are:

$route['default_controller'] = "our_menu";
$route['our_menu/menu'] = "our_menu/menu";
$route['product/:num'] = 'catalog/product_lookup';
$route['admin'] = 'admin/login';
$route['404_override'] = '';

I also test this by removing other routes except default_controller. my php version is 5.6

Can anyone know this how we can handle the other routes.Thanks

1

1 Answers

0
votes

My Query Strings was enabled and for this redirect like this

redirect('c=welcome &m=index', 'refresh');

and URL index.php?c=our_menu&m=menu

Or if change configuration in config.php then you need to change the c and m like

$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

if I change the $config['enable_query_strings'] = TRUE to $config['enable_query_strings'] = FALSE then URL works like index.php/our_menu/menu