Welcome Guest, Not a member yet? Register   Sign In
Url segments not working. Has this got to do with the server configuration
#1

[eluser]simpleCoder[/eluser]
Hi Guys
I got PHP Version 4.4.8-dev . My app works great on my local sever but when i upload it to the host i get page not not found errors(This errors are not code ignitor custom errors but HTTP 404 default errors).

I have set my base_url correctly but code ignitor does not seem to support the notation www.mysite.com/index.php/controller/method in host server. Do i need to configure the host server to accept (/) after index.php? Am using host smartyhost in australia
#2

[eluser]mazaka[/eluser]
I just started experiencing the same thing when uploading to my webhost, Network Solutions.
does anyone have any ideas on this?

thx!
#3

[eluser]tonanbarbarian[/eluser]
it is most likely something about the webserver rather than PHP
any information about what webserver and what version might be helpful

i.e. apache 1.3, iis5 etc

it the site is running apache I would check to see if modrewrite is already on or not. maybe the mod rewrite is on by default and it attempting to remove the index.php from the url unsuccessfullt. just a guess though
#4

[eluser]mazaka[/eluser]
Thanks for the fast reply!

I ran a phpinfo() on the site and got this:

PHP 4.4.7 !!! Too old?
Linux vux30 2.6.15.6-INQUENT #1
Apache/2.2.4 (Unix) FrontPage/5.0.2.2635


The htaccess I am using is woking fine on this server setup, except for root/controller/method call

RewriteEngine on
RewriteCond $1 !^(index\.php|public|img|inc|uploads|static|css|tmp|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ /dir1/dir2/index.php?/$1 [L]


any ideas?
#5

[eluser]joeles[/eluser]
Try this for your .htaccess instead and see if it helps.
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
#6

[eluser]simpleCoder[/eluser]
I have tried the .htaccess on my server but still does not work for www.mysite.com/index.php/controller/method

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
#7

[eluser]mazaka[/eluser]
Not sure if this applies to other people, but I realized what caused the unexpected behavior:

My metod was called "view" :/ Which apparently was acceptable in PHP 5.x, but when switching to a 4.x env it stopped working.

So swithing my contoller method from /cart/view to /cart/viewitems made it work

hope it helps someone.
#8

[eluser]Subekti Pranoto[/eluser]
File “/<webroot>/system/application/controllers/welcome.php” like this:

==============================================================================
&lt;?php

class Welcome extends Controller {

function Welcome()
{
parent::Controller();
}

function index()
{
$this->load->view('welcome_message');
}

function Test()
{
echo "CI is great";
}

}
?&gt;

==============================================================================

when i point my browser to “http://localhost/index.php/welcome/test”, i get message “The page cannot be found”.

when i point my browser to "http://localhost/index.php?c=welocme&m=test", i get the message "CI is great".

it is so far as i know. may help you.
#9

[eluser]tonanbarbarian[/eluser]
Ok here is what I have found...
Simply going through the config options and explaining what they should be set to to begin with

In the application/config/config.php file there are serveral options that will effect the routing and getting it to work properly. Note they are not all together in the config file but I will list them here as if they were

This is the default settings for these options
Code:
$config['base_url'] = "";
$config['index_page'] = "index.php";
$config['uri_protocol']    = "AUTO";
$config['enable_query_strings'] = FALSE;

By default simply set the base_url to your site WITH a trailing slash.
Code:
$config['base_url'] = "http://localhost/";
Now try to go to your site using the following url
http://localhost/index.php/welcome/test

If this does not work then CI is probably not detecting the uri_protocol correctly.
So try each of the following options.
Code:
$config['uri_protocol']    = "PATH_INFO";
Code:
$config['uri_protocol']    = "QUERY_STRING";
Code:
$config['uri_protocol']    = "REQUEST_URI";
Code:
$config['uri_protocol']    = "ORIG_PATH_INFO";
Generally one of these options should work.
If none do then your only resort may be to use the enable query string.

If you find a combination that works, and you are able to use .htaccess then you can look at removing the index page.
Code:
$config['index_page'] = "";

With all these sorts of things you are best to start off with the default values and try the options in a logical sequence, and for me this sequence has worked pretty well in the past to find the combination that will work.




Theme © iAndrew 2016 - Forum software by © MyBB