1

This is what I've in the config/routes.php

$route['music/artist/:any'] = "music/artist/index/$1";

And I've my controller, 'artist', inside a folder music/

I tried to get the uri segment inside the index method from the artist controller but when I go to the browser with domain.com/music/artist/abc it returns page not found.

How can I make this work? But I want to have my controller inside that folder.

Any help will be great. Thanks.

1

1 Answer 1

2

Use this in config/routes.php

$route['music/artist/(:any)/(:any)'] = "music/artist/index/$1"; 
Sign up to request clarification or add additional context in comments.

3 Comments

Hi it didn't work. It seems even I comment out this route config line and then go to domain.com/music/artist/ and still display 404 page not found. It's like it didn't know there's a artist controller inside the controllers/music/ folder but other folder I created earlier inside controllers/ still works. Any idea what's the issue?
Okay, I just found the issue and it works with the way I've. It's just I also have a music.php inside controllers/ so properly just conflicting each other.
Glad to know that you fixed the issue.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.