Welcome Guest, Not a member yet? Register   Sign In
.htaccess / apache problem in URI routing?
#1

[eluser]taewoo[/eluser]
Hi everyone.

I made an app.. which I uploaded to a shared hosting service provider.
I noticed that ALL HTTP requests, regardless of URI, is coming as if they're ignored.. in another words http://server.com/page/some_where is exactly same as http://server.com/.... this is true of ANY requests. I am not certain why this is happening because I am using same index.php and .htaccess as my previous CI apps.

From what I can tell.. the database is loading correctly and the front page controller is loading.

Can someone give me an insight into this?
Here's my .htaccess
Code:
<IfModule mod_rewrite.c>
    DirectoryIndex index.php
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

</IfModule>

<IfModule !mod_rewrite.c>

    ErrorDocument 404 /index.php
</IfModule>

And my index.php (pretty standard CI index.php.. i just removed the comments)

Code:
&lt;?php
    error_reporting(E_ALL);

    $system_folder = "system";

    $application_folder = "application";

if (strpos($system_folder, '/') === FALSE)
{
    if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
    {
        $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
    }
}
else
{
    // Swap directory separators to Unix style for consistency
    $system_folder = str_replace("\\", "/", $system_folder);
}

define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');

if (is_dir($application_folder))
{
    define('APPPATH', $application_folder.'/');
}
else
{
    if ($application_folder == '')
    {
        $application_folder = 'application';
    }

    define('APPPATH', BASEPATH.$application_folder.'/');
}

require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;

/* End of file index.php */
/* Location: ./index.php */
#2

[eluser]taewoo[/eluser]
I think i found my own solution..
For some reason, it'll work on my host if i add a '?' to this line

Code:
RewriteRule ^(.*)$ index.php?/$1 [L]

Could this be an Apache version issue? my host's apache version is Apache version is 2.2.11 .. mine is 2.2.6
#3

[eluser]Flemming[/eluser]
this solution worked for me too. I've just moved a site from Apache 1.3.7 to 2.2.11

all my urls were pointing back to the index (every page was displaying as the home page) - adding a '?' after index.php got it working.

Alternatively, changing [L] to [R] at the end of the rewrite rule had the same fixing effect but of course the uri displayed as the mod rewritten version, e.g. www.mysite.com/index.php/controller

still wondering why... :long:
#4

[eluser]taewoo[/eluser]
[quote author="flemming" date="1234809262"]this solution worked for me too. I've just moved a site from Apache 1.3.7 to 2.2.11
[/quote]

DAMN. 1.3.7? What did you program in? Assembly language? ;P


[quote author="flemming" date="1234809262"]
still wondering why... :long:[/quote]

I don't know. And it seems like folks @ EE aren't really paying attention to the forum posts either.
#5

[eluser]Colin Williams[/eluser]
It's not at all a CI issue, it is an issue with your mod_rewrite setup.
#6

[eluser]Flemming[/eluser]
Absolutely Colin - I should have said at the end of my post that it was kind of rhetorical - I realise that it is NOT a CI issue! :-)
#7

[eluser]taewoo[/eluser]
[quote author="Colin Williams" date="1234881955"]It's not at all a CI issue, it is an issue with your mod_rewrite setup.[/quote]

Ditto on Flemming.
We need help with mod_rewrite.. not CI
#8

[eluser]SitesByJoe[/eluser]
I concur that it's your mod_rewrite. Here's what I use.

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

Almost the same, but the order of the lines does make a difference - I run the file checks first.
#9

[eluser]taewoo[/eluser]
Hey SitesByJoe.
Thanks but that doesn't seem to solve the problem... ;/




Theme © iAndrew 2016 - Forum software by © MyBB