remove index from url! |
[eluser]Unknown[/eluser]
hello, i'm trying to make multi pages without index like this example.com/page/index/sagaw this is the php i use Code: <?php
[eluser]Punisher[/eluser]
If you want to remove index.php in url you need to setup your .htaccess file. This file should be in your root ci folder. So your .htaccess file should look like this. for example where http://localhost/ci_rootfolder/ Code: RewriteEngine On Remember to replace ci_rootfolder with your ci folder name. Also you need to setup mod_rewrite if you didn't do so on your server for this to work. Just to be clear if your ci_rootfolder is in fact your root web folder on server then you can have .htaccess file that looks like this. for example where http://example.com/ Code: RewriteEngine On
[eluser]Unknown[/eluser]
thanks Punisher, but i've fixed it by adding this line $route['page/(:any)'] = "page/index/$1"; at routes.php
[eluser]sv3tli0[/eluser]
Using Code: $route['page/(:any)'] will kill any posibility to access to any other method in the Page controller! In your case I can suggest you to name your class different from the required url and then to add custom route. For example... Code: Controller Pages and perhaps to use not index method, but perhaps a view... Code: $route[‘page/(:any)’] = “pages/view/$1”; |
Welcome Guest, Not a member yet? Register Sign In |