Welcome Guest, Not a member yet? Register   Sign In
cannot access controller while I have a default controller set
#1

[eluser]hamobi[/eluser]


i have two controllers in the same folder. one is named criteria, and one is named reviewApprove. Their code is identical (other than the class name)

if i set criteria to the default controller in routes, then I am able to access it, but no matter what I cannot navigate to the reviewApprove controller.

If i dont set a default controller and navigate to index.php/reviewApprove, or index.php/criteria.. that will work just fine

if I set reviewApprove to the default controller I can see it as well.

My htaccess file is set. I have compared my project to a few other code igniter projects and cant tell what I'm doing wrong. Anyone have any ideas?

I have all corresponding code posted here..

http://stackoverflow.com/questions/89769...roller-set
#2

[eluser]InsiteFX[/eluser]
Try removing the ? mark on all your rewrite rules!
Code:
RewriteRule ^(.*)$ index.php?/$1 [L]

// to
RewriteRule ^(.*)$ index.php/$1 [L]
#3

[eluser]hamobi[/eluser]
I followed your suggestion but I am not seeing any difference.

i am accessing my default controller like this:

http://localhost/certifiedAnalytics/

i am trying to access the other controller (located in the same folder like this):

http://localhost/certifiedAnalytics/reviewApprove
#4

[eluser]Aken[/eluser]
What does your directory structure look like? Are these controller files located in the applications/controllers directory, or a subdirectory of that folder, etc...?

I'm guessing you're just trying to load the wrong URL based on the file structure.
#5

[eluser]hamobi[/eluser]
[quote author="Aken" date="1327354199"]What does your directory structure look like? Are these controller files located in the applications/controllers directory, or a subdirectory of that folder, etc...?

I'm guessing you're just trying to load the wrong URL based on the file structure.[/quote]

screenshot of file structure
#6

[eluser]Aken[/eluser]
Okay, that's fine then. I also read again where you said if you access it from index.php it loads properly.

Is the 404 error generated by CodeIgniter or localhost? I'm guessing its an .htaccess issue - should have nothing to do with the default controller.
#7

[eluser]hamobi[/eluser]
[quote author="Aken" date="1327354914"]Okay, that's fine then. I also read again where you said if you access it from index.php it loads properly.

Is the 404 error generated by CodeIgniter or localhost? I'm guessing its an .htaccess issue - should have nothing to do with the default controller.[/quote]

the error is generated by localhost.

i also cant access any of the functions within my default controller other than the construct and index functions..


EDIT: i cant access them if i use a default controller. if i use index.php/criteria/blah

then i can access the blah function
#8

[eluser]Aken[/eluser]
Post your whole .htaccess file, I'll see if anything looks weird. You left some of it out on SO.

Regarding the functions, remember that when you set a default controller, only the index() function is used for the homepage. Any other methods will still need to be accessed through traditional controller URLs, unless you set up specific routes to point them properly.

So if you set your default controller to "criteria", the criteria index() function will show on the homepage. If you want to access criteria's something() function, you need to go to localhost/certifiedAnalytics/criteria/something (that is once you get htaccess working properly).
#9

[eluser]hamobi[/eluser]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /CertifiedAnalytics/

#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
</IfModule>

EDIT: PASTED WRONG ONE ORIGINALLY
#10

[eluser]hamobi[/eluser]
something must be wrong with htaccess because this is not working either

http://localhost/certifiedAnalytics/criteria/blah

blah is the function




Theme © iAndrew 2016 - Forum software by © MyBB