I need to route for example to "www.url.com/controller/function" i put the code in 'config.php' in routes but, doesn't work. i need to load to views in the same controller, without put 'index.php' in the url. It is possible?
-
what is your actual question ? Do you want to remove index.php from url ? – chhameed Aug 09 '12 at 04:23
-
@Hameed i will take your advice. And really i want to show to different views without put index.php/controller – MrSanders Aug 09 '12 at 15:25
2 Answers
here is the helping url to remove the index.php from url
you have to use .htaccess file to remove index.php from url
Hope it helps
Updated
Have a look in the application\config\config.php file, there is a variable named 'index_page'
It should look like this
$config['index_page'] = "index.php";
change it to
$config['index_page'] = "";
here is the .htaccess file you can use this..
RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Here are some use full links.. you can follow these..
remove index.php stackoverflow
remove index.php codeigniter forum
Enable mod rewrite from your server
Hope these will help you
-
actually i need to show to different views without putting index.php/controller/ when i do that, all the sources doesn't load. – MrSanders Aug 09 '12 at 15:26
-
@MrSanders: Dear i have update my answer. see it and hope now you will get rid from index.php – chhameed Aug 10 '12 at 03:36
By default, the index.php file will be included in your URLs:
www.url.com/index.php/controller/function
You can easily remove this file by using a .htaccess file with some simple rules. Here is an example of such a file, using the "negative" method in which everything is redirected except the specified items:
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
Put the .htaccess file containing the above code to your app root folder.

- 5,476
- 2
- 31
- 52