codeigniter - How to remove index.php ina codeignitor site to help seo -
i new in codeignitor ...i want remove "index.php"from url
http://localhost/simpleblog/index.php/blogger/newblogs
i need
http://localhost/simpleblog/blogger/newblogs
here shows controller code
class blogger extends ci_controller { public function newblogs() { $this->load->helper('url'); $this->layout="yes"; //<-- add this*/ /* $this->load->view('welcome_message');*/ $this->load->view('pages/secondpage'); }
}
default controller
public function index() { $this->load->helper('url'); $this->layout="yes"; //<-- add this*/ /* $this->load->view('welcome_message');*/ $this->load->view('pages/mainpage'); }
how remove index.php ?
removing index.php file
by default, index.php
file included in urls:
example.com/index.php/news/article/my_article
you can remove file using .htaccess
file simple rules.
rewriteengine on rewritecond $1 !^(index\.php|images|robots\.txt) rewriterule ^(.*)$ /index.php/$1 [l]
see documentation
Comments
Post a Comment