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...

1

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

4 Comments

how do i call the route in the href link ?? Thank you
i already mentioned in line one that where you have to define route
no i mean how do i call the route in href link ... <li> <a href="IN_HERE">services</a> </li>
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. ` <li><a href="route_name_you_want_to_show">services</a>`
0

Try to edit route to your route.php file, You can find it in application/config/route.php.
After add line like $route['mycustomurl'] = 'Services/index'; and your url is like http://localhost/index.php/mycustomurl. For more details about codeigniter route don't hesitate to read the documentation https://www.codeigniter.com/userguide3/general/routing.html.

if you want to remove index.php
This would help CodeIgniter removing index.php from url

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.