0

I want to display this URL,

http://localhost/cosmetics2/index.php/Services/index

without displaying the controller name and the function name... so how to do that can u please tell me to how to fix this...

Madhuri Patel
  • 1,270
  • 12
  • 24
R.Minod
  • 33
  • 5
  • 5
    Possible duplicate of [Hide codeigniter both controller and method name from url](https://stackoverflow.com/questions/35186185/hide-codeigniter-both-controller-and-method-name-from-url) – Sinto Jan 28 '19 at 12:35

2 Answers2

2

We can use routes for that, In your application/config/routes.php.

See the example,

$route['route_name_you want_to_Show'] = 'Services/index';

Reference

And if you want remove index.php then add below code into .htaccess

htaccess

RewriteEngine On
RewriteBase /ci/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

ErrorDocument 404 /index.php
Pang
  • 9,564
  • 146
  • 81
  • 122
Madhuri Patel
  • 1,270
  • 12
  • 24
  • 1
    okay...in that place you can write the name which you write in `$route['route_name_you_want_to_show']`. So in your where you want to use route, you can write the same name you use. `
  • services`
  • – Madhuri Patel Jan 28 '19 at 15:24