Routing issue

Hi Everyone,

First message here, so first thanks in advance for your welcome Smile

I watch and install the source file of shawn videocast (Shawn VideoCast)

I edit all config files to make it work on my local pc (config,virtual host, host)

When i try the url i'm redirect to the default controller that's good.

But when i try to reach other controller (login, dashboard) i get 404 error.

And my 404 error are not displayed with CI 404 template but default browser.

I think i've got a routing issue but after 4 hours research i can't find where....

here is my routes.php

$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";
$route['login'] = "main/login";
$route['logout'] = "main/logout";

thanks a lot for your help

If you're getting the apache 404 it means the request is never reaching CI. Something awry with your htaccess, are you using one? Are you including index.php in your url?

here is htaccess file
<IfModule mod_rewrite.c>
    RewriteEngine On

    #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 !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

u talk about .htaccess file from default CI directory ?

when i try it works

but when i try i get apache 404...weird

Is there a reason you have nothing after RewriteBase? If your index.php is in webroot you should leave that value as / or remove it completely. There's also really no reason to be mixing rewritebase with absolute paths in your rewriterules (I realize this is something that comes from the wiki)

You can also try removing the ? after index.php.

Have you looked at apache's error log?

[Mon Sep 13 11:21:22 2010] [error] [client] File does not exist: C:/LocalPagesDirect/
here is apache error

Honestly i'm not very good with .htaccess

I first used shawn ones
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|resources)
RewriteRule ^(.*)$ /index.php/$1 [L]

but i get internal server error on apache so i found the first one on forum Smile

Do you have a good .htaccess to recommend me ?


Finally the original htaccess was good
i just add to uncomment this line on http.conf

LoadModule rewrite_module modules/

problem solved

Quote:i just add to uncomment this line on http.conf

LoadModule rewrite_module modules/

problem solved

It's odd that removing the mod_rewrite module would fix a problem with rewriting not happening properly.

Quote:when i try it works

but when i try i get apache 404…weird

Since the first line works, your codeigniter is working properly. The second one not working means that you don't have the proper rewrite rules (see noctrum's suggestions above - the ? should not be there unless you're using $config['uri_protocol'] = "QUERY_STRING";

If the second line is not working properly, try the uri_protocol "REQUEST_URI", and each of the others, to see if one of them works.

Also, check to ensure that in config.php
$config['index_page'] = "";

Give those things a shot and see if it makes your URLs much nicer Wink

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.