Welcome Guest, Not a member yet? Register   Sign In
[Error 404] Routing vs htaccess
#1

Hello all,

I am new to CI and this is my first application (project name: codeigniter).

I have a single controller named : Reports

which consists of 2 methods :

public function index() => [I assumes this is the default and it redirects to view('pages/logcatcher')]

public function flowmetercatcher() => [redirects to view('pages/flowmetercatcher')]

I have already removed the index.php using my htaccess file
Code:
RewriteEngine On
RewriteBase /codeigniter/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

$config['base_url'] = 'http://monitor.vbu.fr/codeigniter';

When i acccess the above link, it works well but then i click the flowmetercatcher page, i get an 404 error.

Here is my routes :
Code:
$route['default_controller'] = 'reports';
$route['(:any)'] = 'reports/$1';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;



I have tried to view the page source but could't figured it out.
Code:
<li class="nav-item active">
     <a class="nav-link" href="http://monitor.vbu.fr/codeigniter/">LOGCATCHER</a>
</li>
<li class="nav-item ">
     <a class="nav-link" href="http://monitor.vbu.fr/codeigniter/flowmetercatcher">FLOWMETERCATCHER</a>
</li>

Can someone tell me what i am missing please ?

Thank you in advance.

Best regards, ash
Reply
#2

@ash,

I hate to assume but did you follow the instructions in the documentation ( https://codeigniter.com/user_guide/gener...x-php-file )?

Also, does your apache server have mod_rewrite enabled?
Reply
#3

Try replacing this.
PHP Code:
$route['(:any)'] = 'reports/$1';

// with this
$route['reports/(.+)'] = 'reports/$1'
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(05-29-2018, 12:44 PM)php_rocs Wrote: @ash,

I hate to assume but did you follow the instructions in the documentation ( https://codeigniter.com/user_guide/gener...x-php-file )?  

Also, does your apache server have mod_rewrite enabled?

Hello,

Thank you for your reply.
Indeed, the mod_rewrite was not enabled.

But as i am hosting the application within an IIS server, i was able to activate it using the web plateform.
https://manage.accuwebhosting.com/knowle...erver.html

Thanks you very much. The issue is now solved.

Best regards,
ash
Reply




Theme © iAndrew 2016 - Forum software by © MyBB