CodeIgniter Forums
Default controller is always loaded event the URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Default controller is always loaded event the URL (/showthread.php?tid=52057)

Pages: 1 2


Default controller is always loaded event the URL - El Forum - 05-28-2012

[eluser]zerofook[/eluser]
Hello guys.
I'm new to CodeIgniter.
I downloaded the latest version(2.1.0) of the CodeIgniter framework.
Now I'm testing the framework, but I was stuck with an url issue.
I'm using Ubuntu 12.04 and apache2 server.
My application is stored in /var/www/fleezor folder.
The problem is that if I request http://localhost/fleezor I'm getting the main controller view, which is the correct behaviour, but if I request http://localhost/fleezor/test/index (ot http://localhost/fleezor/index.php/test/index) I'm redirected again to the default_controller page (the "main" controller).

I was made all of the needed configurations. My configurations are:


conf.php

Quote:$config['base_url'] = 'http://localhost/fleezor/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

httpd.conf
Quote:<Directory "/var/www/fleezor">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

.htaccess
Quote:<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /fleezor/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

routes.php
Quote:$route['default_controller'] = "main";
$route['test'] = 'test';

P.S. The code in the test controller is working properly. I have tested it if I switch the default_controller to be "test".

Please HELP me !!! Smile

Regards, Lubo.



Default controller is always loaded event the URL - El Forum - 05-28-2012

[eluser]InsiteFX[/eluser]
If you are keying it in on the browser do not add the /index on the end of it.

Code:
http://localhost/fleezor/test

Controllers default to running the index method.



Default controller is always loaded event the URL - El Forum - 05-28-2012

[eluser]zerofook[/eluser]
[quote author="InsiteFX" date="1338244499"]If you are keying it in on the browser do not add the /index on the end of it.

Code:
http://localhost/fleezor/test

Controllers default to running the index method.
[/quote]

I tried this -> same problem.


Default controller is always loaded event the URL - El Forum - 05-28-2012

[eluser]InsiteFX[/eluser]
You must have something else wrong in another place because that should work,

Try remove your .htaccess file and see if it works!



Default controller is always loaded event the URL - El Forum - 05-28-2012

[eluser]zerofook[/eluser]
[quote author="InsiteFX" date="1338245343"]You must have something else wrong in another place because that should work,

Try remove your .htaccess file and see if it works!
[/quote]

I renamed the .htaccess file and the same problem occured.

This time I have to access the url like this localhost/fleezor/index.php/test, beacuse of the removed .htaccess file, haven`t I ?


Default controller is always loaded event the URL - El Forum - 05-28-2012

[eluser]InsiteFX[/eluser]
Yes you need to add the index.php back into the config or add it to the link.



Default controller is always loaded event the URL - El Forum - 05-29-2012

[eluser]zerofook[/eluser]
Any other suggestions ?


Default controller is always loaded event the URL - El Forum - 05-29-2012

[eluser]gRoberts[/eluser]
Code:
<IfModule !mod_rewrite.c>
  ErrorDocument 404 /index.php
</IfModule>

The above "could" be the cause. If you remove this temporarily, does it work?


Default controller is always loaded event the URL - El Forum - 05-29-2012

[eluser]zerofook[/eluser]
[quote author="gRoberts" date="1338289782"]
Code:
<IfModule !mod_rewrite.c>
  ErrorDocument 404 /index.php
</IfModule>

The above "could" be the cause. If you remove this temporarily, does it work?[/quote]

I was removed the .htaccess file, but now I tried with it. I removed this tag, but again it's not working.

Is it possible the problem to be in the apache2 server ?


Default controller is always loaded event the URL - El Forum - 05-29-2012

[eluser]Aken[/eluser]
Try changing your uri_protocol item in application/config/config.php