⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Can Not Run GC without index.php in CI 3.x



luki

luki
  • profile picture
  • Member

Posted 30 August 2016 - 13:23 PM

I have used CI 3.x in many projects without index.php in the URL.

 

How I do that:

 

.htaccess:

 

# based on CI 3.x documentation

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

 

or

 

# based on earlier CI

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [PT,L]

 

CI 3.x config:

 

$config['base_url'] = 'http://mypc.local';

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';

 

With configurations above:

 

it works for http://mypc.local/home

it works for http://mypc.local/index.php/home

it works for other websites which don't utilize GC

it works for http://mypc.local/index.php/examples (GC)

 

BUT not for http://mypc.local/examples (GC)

it always shows:

Service unavailable!

 

anyone can help?