Welcome Guest, Not a member yet? Register   Sign In
Does CI require URL Rewriting to be enabled ?
#1

[eluser]hbr[/eluser]
Hi everyone,

May be this question seems a bit stupid, well I've tried to run a simple hello world app but in vain.
I get this error "Unable to determine what should be displayed. A default route has not been specified in the routing file."

While in Query String mode, (c=XXX&m=yyy), it works fine.

It is not mentioned in any page of the doc that URL Rewriting should be enabled, the only time it talks about it is in the URLs section, to explain how to remove the index.php.

Here is how I did it:
config.php => $config['base_url'] = "http://localhost:8000/boffice/";
controllers/account.php =>
Code:
<?php
class Account extends Controller {
    function index() {
        echo "hello";
    }
}    
?>

I try to access this page by typing http://localhost:8000/boffice/index.php/account

Correct ? Any idea ?
#2

[eluser]GSV Sleeper Service[/eluser]
the error message explains the problem, you need to edit your routes.php file and set the default controller
[code]
$route['default_controller'] = "account";
[code]

and no, mod_rewrite does not have to be enabled for CI to work.
#3

[eluser]hbr[/eluser]
Thanks for answering Smile
CI comes with a default controller called "Welcome" and which is defined as the default one.
Anyway, i've changed it to "account", now this way account works fine, but NOT "welcome".
When I type http://localhost:8000/boffice/index.php/welcome it stil displays account's "Hello" text, which means it did not detect "welcome"
#4

[eluser]Pascal Kriete[/eluser]
Try changing the uri protocol in the config file to something other than auto (options listed there).
#5

[eluser]hbr[/eluser]
Nope, it doesn't work neither, with REQUEST_URI and ORIG_PATH_INFO it shows a 404 and with the others it keeps displaying "Hello" instead of switching to the default "Welcome" screen (http://localhost:8000/boffice/index.php/welcome).

By the way, I am running Aprelium Abyss Webserver X1 2.5 with PHP5.2, I am not using the standard Apache.
#6

[eluser]Pascal Kriete[/eluser]
I'm assuming it's your webserver.

One more thing to try is adding a question mark after the index.php, such as index.php?/controller/bla/bla.

The last option then, is to rewrite.
I've never worked with Abyss, but their rewriting options are quite logical.

Something like this should do it (in fact, you could probably leave out the index.php while you're at it):
Quote:Regular Expression: /boffice/index.php/(.+)
Redirect to: /boffice/index.php/$1
#7

[eluser]hbr[/eluser]
hi,

It didn't work neither.

One more strange thing, I've installed Wordpress which seems to be using the same URL mode as CI and it works fine under Abyss 2.5. By tying "http://localhost:8000/wordpress/index.php/2008/01/30/test-test/" I access my "test test" post successfully.
So I really don't understand what's on with CI.
#8

[eluser]hbr[/eluser]
does anyone have an idea please ?
#9

[eluser]hbr[/eluser]
ok now I am pretty sure it is the couple (Abyss,CI) that does not work. I've just tried the hello world tutorial with EasyPHP2 and it works fine.
But I still don't understand why Wordpress works under Abyss while it uses the same URI style. I am almost sure it is the $config['uri_protocol'] that is not recognized in Abyss, but on the other hand I've tried all the possibilities, and none worked. I'll try to figure out how Wordpress is dealing with it.
#10

[eluser]hbr[/eluser]
fixed

if anyone is using Abyss here is the trick:
http://www.aprelium.com/forum/viewtopic....t=pathinfo


it is all about php and the way it conforms to CGI.
I juste set cgi.fix_pathinfo = 1 and in Abyss Console, set Scripting Parameters :: Interpreters :: type to "Standard" instead of "PHP Style".

Then in CI leave $config['uri_protocol'] = "AUTO";




Theme © iAndrew 2016 - Forum software by © MyBB