• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code to delete index.php in Codeigniter 3 and lowercase name to controllers/models

#1
I've done some web pages codeigniter 3 everything runs perfect in a local environment , but when I load it on a web server and have some problems:

I've done some web pages codeigniter 3 everything runs perfect in a local environment , but when I load it on a web server and have some problems :

1.- Do not remove the index.php in the URL , the problem may be caused by .htaccess code that use:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

2.- Do not locate controllers and models that are in lowercase . For example I have a controller called home.php , in the local environment but normally runs on the web server shows me the following error "No input file specified.", this is resolved by renaming the controller home.php to Home.php


Aesthetic form in the url , try removing the index.php and display controllers and models in lowercase . These are the problems I've had with this new version of CodeIgniter ( v3 ), what has changed?, how do I fix these details?

Please help me.
Reply

#2
This code in .htaccess works for me:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
Rename all your controllers, libraries and models so that they start with a capital letter.
Also make sure that your config.php contains this line:
PHP Code:
$config['index_page'] = ''
Reply

#3
Read the CodeIgniter User Guide.

Change Log
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#4
Depending on the server, you may need to change your RewriteRule to this:
Code:
RewriteRule ^(.*)$ /index.php?/$1 [L]

while leaving the rest of your .htaccess code the same.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.