-1

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?

MrSanders
  • 63
  • 1
  • 1
  • 8

2 Answers2

0

here is the helping url to remove the index.php from url

User Guide remove index.php

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

Community
  • 1
  • 1
chhameed
  • 4,406
  • 4
  • 26
  • 44
  • 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
0

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.

Arun Jain
  • 5,476
  • 2
  • 31
  • 52