How to hide controller and method name from url in codeigniter?
you can hide controller and method name from url using route.
when you click on this url its show mycontroller on the url bar.
For example, if your project url is like http://localhost:8080/ci/site/pages/Home
here “site” is your controller name
“pages” is controller function/method name and
“Home” is parameter of pages function.
Now if we remove controller name from url,it should work , http://localhost:8080/ci/pages/Home
Open application/config/routes.php file ,and modify the entire code like this
For example, if your project url is like http://localhost:8080/ci/pages/Home
here pages is function name and Home is parameter of that function.
Now if we remove function name from url,it should work , http://localhost:8080/ci/Home
Open application/config/routes.php file ,and add the below lines
Include the below lines in your codeigniter .htaccess file
/ci/ is path of your codeigniter folder , here i placed my codeigniter folder in C:/xampp/htdocs/
#----------------------------------------------------------------------
RewriteEngine On
RewriteBase /ci/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [PT,L]
#----------------------------------------------------------------------
Trending Tutorials