Question: I am trying to redirect to a controller at the click event of a button. The controller file is practiceTest.php. It has an index function that redirects to another view from there. Unfortunately, I keep getting a 404 not found error. 

The relevant code:

```
<input style='position: absolute; right: 0;' type="button" id='rounded_practice' value="Begin Practice" onClick="location.href='/practiceTest'">

```

Any help spotting what I may have missed would be appreciated.

Answer: 
The URL is wrong.If you click on the button You will see you are redirecting wrong URL.You should use full URL instead of relative URL.As you are using CI you can try this way(assumed `practiceTest` is one of your controller name)

```
onClick="location.href='<?php echo site_url('practiceTest');?>'">

```
you can also use `base_url();/pathforyourcontrollername`