Menaka Kariyawasam
Menaka Kariyawasam

Reputation: 618

How to set routes.php for change my url in CodeIgniter?

I have to change www.sample.com/welcome/aboutus to www.sample.com/aboutus , but when I go to www.sample.com/aboutus it displays a 404 error page. I've tried to route, but I can't get this to work.

I tried this one in config/routes.php page,

$route['welcome/aboutus'] = 'aboutus';

and this is my header page code,

<a href="<?php echo base_url('welcome/aboutus');?>">About Us</a>

please help me to fix this issue.

thank you.

Upvotes: 1

Views: 215

Answers (1)

Menaka Kariyawasam
Menaka Kariyawasam

Reputation: 618

yes I did it.this is the right way.I was change my config/routes.php page

$route['aboutus'] = 'welcome/aboutus';

and I changed my header page,

<a href="<?php echo base_url('aboutus');?>">About Us</a>

I think this is the right way.

Upvotes: 1

Related Questions