Welcome Guest, Not a member yet? Register   Sign In
Can't access anything but the default controller
#1

[eluser]Unknown[/eluser]
I apologize in advance - I inherited this mess from another consultant, and I've never worked with CodeIgniter before. I've been through the forums but still can't get this to work.

The problem is accessing any other controller other than the default. The results are:

http://www.abcd.com Default controller
http://www.abcd.com/index.php Default controller
http://www.abcd.com/admin 404 error
http://www.abcd.com/index.php?admin/login Correct page

The login is not set as a controller, but admin is. If not logged in, admin points to login function in admin.php which loads login_view from the application\views\admin folder.

Currently I do not have any .htaccess file set.

I'm just trying to move to a different hosting site, and it worked fine on the previous host with the same setup.

I tried:
1. Adding .htaccess file with the following - still a 404 error since it rewrote the url as www.abcd.com/index.php/admin/login (no ? and a slash)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

2. Adding the following routes: - no change
$route['admin/login'] = "admin/login";
$route['admin'] = "admin";
3. The base url is revised and working (otherwise the default controller wouldn't work)
4. index_page is blank
5. uri_protocol is AUTO - tried some of the others with no success

I'd appreciate any suggestions...thanks!
#2

[eluser]Unknown[/eluser]
Never mind - I fixed it. The solution was:

uri_protocol - AUTO
index_page - blank

htaccess:

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

This is on a GoDaddy shared hosting account, so I'll update the other post with the "definitive" GoDaddy setup as well.
#3

[eluser]coldfire82[/eluser]
[quote author="esenger" date="1268855922"]Never mind - I fixed it. The solution was:

uri_protocol - AUTO
index_page - blank

htaccess:

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

This is on a GoDaddy shared hosting account, so I'll update the other post with the "definitive" GoDaddy setup as well.[/quote]

The above URI routing solution worked gr8 for me. Thanks. I am also using godaddy and was having the similar problem.
#4

[eluser]Unknown[/eluser]
You my friend, are a hero!




Theme © iAndrew 2016 - Forum software by © MyBB