Welcome Guest, Not a member yet? Register   Sign In
Route doesn't work
#1

[eluser]kezman[/eluser]
Hey!
My routes.php doesn't work.
Here the code
Code:
$route["test"] = "blogs";

$route['default_controller'] = "mainpage";
$route['404_override'] = '';

My .htaccess saved in ANSI

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|css|images|robots\.txt|css)
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

In my config.php

Code:
$config['uri_protocol'] = 'AUTO';

I type

Code:
http://localhost/test/

and got "page not found" and the same URL.
What's wrong?
I want URL to be changed to
Code:
http://localhost/blogs/
first

Thanks!
#2

[eluser]InsiteFX[/eluser]
And what is the name of your controller?
#3

[eluser]CroNiX[/eluser]
Routes won't change what appears in the URL anyway; you'd have to do that with htaccess. All a route does is take the request, if it matches the route conditions) and sends it to a different controller than would normally be used.

So if your route was:
Code:
$route["test"] = "blogs";

The url is still "http://yoursite.com/test", but it will load the "blogs" controller (which must exist) instead of the "test" controller (which doesn't have to exist - it's just the named route).




Theme © iAndrew 2016 - Forum software by © MyBB