0

I'm trying to retrieve string as parameter using following URL scheme: www.myapp.com/[String]

Is there any way I can do this?

*Based on my research, Codeigniter doesn't accept string parameters unless I include the Controller's name in URL: www.myapp.com/[Controller Name]/[String] But this doesn't solve my problem :(

1
  • What's you problem. ? Commented Jul 24, 2014 at 0:19

1 Answer 1

2

You're right, CI requires controller name at URI, but You can use default_controller.

At config/routes.php add route rule $routes['(:any)'] = 'welcome/index';, remove index.php from Your URL (there're many tutorials and how-to for this), and at last useuriclass at Yourindex()method ofwelcome` controller:

function index(){
    var_dump($this->uri->uri_string());
}
Sign up to request clarification or add additional context in comments.

1 Comment

After following your instructions, and I type in "myapp.com/[String]", I get redirected to 404. I think it's still looking for the controller (instead of taking parameter)?

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.