• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url

like when i have url like this


i want it to redirect to this one


i have done pretty research but none of them working

Thanks a lot

In the documentation, it's all noted...


The second header: Removing the index.php file

have added this in my htacess file and its not making any diffrence

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

check this url


Are you sure that mod_rewrite is enabled on your server?

Create a PHP page on your web server. For demonstration purposes, call this page phpinfo.php. This file should read as follows:

PHP Code:
<?php phpinfo(); ?>
Now, navigate to this page in your browser and look under the Loaded Modules section. This can be located using Ctrl+F in your browser. In this list try and locate mod_rewrite. If it is listed here, you're good to go. If not, you'll need to enable it. (Source: http://www.codingforums.com/showthread.php?t=215977)

Also, make sure that you set
$config['index_page'] = '';
in your application/config/config.php

i have checked mod _rewrite has been enabled

also made this change
Also, make sure that you set
$config['index_page'] = '';

now its still same

I don't see what is wrong with it now, go to http://jobr.in/clients/the-school-shop/user/login

it works, no?

brother ,

you are not understanding the prob.

prob is both url are working already


but i have to redirect


to this

urls with index.php should not be accessible

It doesn't matter if they are "accessible" if there aren't any links to them (search engines only catalog actually links, and they don't "guess"), unless these are old urls that you are trying to get out of search engines or something.

If you use the url helpers, like anchor(), then you won't have to do anything else to clean up your urls once you change $config['index_page'] to empty string. It won't make links with "index.php" in them. However, if you didn't, and you manually created your anchors using straight up html, then you will have to fix all of those by hand and remove the "index.php". Hopefully you used the CI anchor() function.

The same goes for images and forms. If you made them by hand instead of using CI's helpers, you will have to manually fix all of them.

Yup, didn't understand it.

Put this in your main controllers' __construct after calling the parent::__construct()

The $_SERVER['REQUEST_URI'] is a non-routed url, current_url() is already routed thru your routes.php config file.

Hope this helps.


i have used base_url()

to get urls and i have made $config[‘index_page’] = ‘’; too

so now all links on my website are without index.php

but all links can be accessed if we add index.php

i just want to make sure this will not make any effect on seo of website

will not be these treated as duplicate content

thats all i want to know.....

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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