Part of the EllisLab Network
   
 
Doesn’t work on localhost
Posted: 24 January 2007 10:31 AM   [ Ignore ]  
Summer Student
Total Posts:  28
Joined  01-24-2007

Hello

  I’m only getting started with CI. To go faster, I’d like to use a local web server instead of the one hosted on the Internet, but I can’t get CI to work with the Abyss Web Server X1 that I run on my XP host: Even after making the following changes per the documentation (which work OK on the shared server), I get a 404 when calling the controller on localhost:

1. From ZIP, extracted /system to C:/www/igniter/

2. Edited /www/igniter/system/application/config/config.php:
$config[‘base_url’]  = “http://localhost/igniter/”;

3. Tried calling http://localhost/igniter/index.php/welcome/, to no avail hmmm

4. Added /www/igniter/test.php which echo’s stuff, and it works OK, so it’s not PHP acting up.

Does CI include some Apache-specific code, which would explains the 404 on the lighter Abyss web server?

Thanks!

Profile
 
 
Posted: 24 January 2007 02:07 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
RankRankRank
Total Posts:  551
Joined  06-17-2006

I cant vouch for your web server, but I’ll expect that if they support PHP then you should heve minimal issues.

By the way, Apache also runs on XP, and its free (No Apache ‘lite’).

Have you tried calling just the index.php file
http://localhost/igniter/index.php

This should start Code Igniter, look in config/route.php for the default controller (should be ‘welcome’ if you run CI right out of the box.

If this does not work, the yiu need to look further. If it does work, then try

http://localhost/igniter/index.php?/welcome/

 Signature 

CodeCrafter - Open Source Code Generation for CI

Profile
 
 
Posted: 24 January 2007 04:26 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  28
Joined  01-24-2007
Crafter - 24 January 2007 02:07 PM

By the way, Apache also runs on XP, and its free (No Apache ‘lite’).

Thanks, but Abyss is smaller and runs faster grin

Crafter - 24 January 2007 02:07 PM

Have you tried calling just the index.php file

I get a 404.

Crafter - 24 January 2007 02:07 PM

look in config/route.php for the default controller (should be ‘welcome’ if you run CI right out of the box.

This is the default, which I haven’t changed:

$route[‘default_controller’] = “welcome”;

Crafter - 24 January 2007 02:07 PM

If this does not work, the yiu need to look further. If it does work, then try
http://localhost/igniter/index.php?/welcome/

This works. I guess CI expects to use .htaccess, but I’m not sure Abyss supports it. Is the rewrite thing required to remove index.php?

Thank you.

Profile
 
 
Posted: 24 January 2007 05:06 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  1
Joined  12-23-2006
fredtheman - 24 January 2007 04:26 PM

This works. I guess CI expects to use .htaccess, but I’m not sure Abyss supports it. Is the rewrite thing required to remove index.php?

Yeah, you’ll need something that can rewrite your URI for that to work.

Profile
 
 
Posted: 25 January 2007 12:57 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
RankRankRank
Total Posts:  551
Joined  06-17-2006
fredtheman - 24 January 2007 04:26 PM
Crafter - 24 January 2007 02:07 PM

Have you tried calling just the index.php file

I get a 404.

If this does not work and index.php?/welcome works, my guess is that that the 404 error is thrown by Code Igniter and not your web server. Please verify who is throwing the exception.

If it is CI (most likely from your response), then there seems to be isues with your loading of the default route.

Perhaps look again at your config/config.php file, in particular:

$config['base_url']
$config[
'index_page']
$config[
'uri_protocol']

And CI does not rely on or expect htaccess URL rewriting. That costruct is a feature of the web server and operates independantly from any code running inside the server.

 Signature 

CodeCrafter - Open Source Code Generation for CI

Profile
 
 
Posted: 25 January 2007 01:43 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  28
Joined  01-24-2007

Thankfully, I just saw that the latest (2.4) version of Abyss supports URL rewriting… but using its own engine instead of using .htaccess hmmm

So I need to understand what the .htaccess sample given in the Code Igniter documentation means before trying to rewrite it to work with Abyss’ URL Rewriting module.

Here’s the .htaccess that works when I upload the app on a shared host that runs Apache:

—————
RewriteEngine on
RewriteRule ^$ index.php [L]
RewriteCond $1 !^(index\.php|assets|search)
RewriteRule ^(.*)$ index.php/$1 [L]
—————

1. Does the first line mean that if the URL is empty for that part of the URL (eg. http://localhost/igniter/), it should append index.php (to turn into http://localhost/igniter/index.php)?

2. In the RewriteCond line, what does $1 stand for? I haven’t found information on this type of variable. Is it somehow related to a $1 reference in regexes?

Thanks!

Profile
 
 
Posted: 25 January 2007 01:56 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  28
Joined  01-24-2007
Crafter - 25 January 2007 12:57 AM

If this does not work and index.php?/welcome works, my guess is that that the 404 error is thrown by Code Igniter and not your web server. Please verify who is throwing the exception.

Yes, it’s thrown by CI, not the Abyss web server.

Crafter - 25 January 2007 12:57 AM

If it is CI (most likely from your response), then there seems to be isues with your loading of the default route.

I haven’t made any changes to config.php, save setting $config[‘base_url’] to “http://localhost/igniter/”.

FWIW, here are the other two:

$config[‘index_page’] = “index.php”;
$config[‘uri_protocol’]  = “AUTO”;

Crafter - 25 January 2007 12:57 AM

And CI does not rely on or expect htaccess URL rewriting. That costruct is a feature of the web server and operates independantly from any code running inside the server.

OK. So I must figure out how to adapt Apache’s .htaccess above to Abyss’ URL rewriting engine. I’m stuck at the $1 in the RewriteCond line.

Thanks.

Profile
 
 
Posted: 25 January 2007 08:09 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  28
Joined  01-24-2007

Finally got it to work grin

Using Abyss X1 2.4 and its URL Rewriting module, here’s how to use clean URLs, with CI installed in /igniter/ :

^/igniter/(.*)$
Perform an internal redirection
/igniter/index.php?/$1   <- note the ?
Continue with the next rule

Hope this helps.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 64455 Total Logged-in Users: 22
Total Topics: 80961 Total Anonymous Users: 0
Total Replies: 435697 Total Guests: 182
Total Posts: 516658    
Members ( View Memberlist )