简体   繁体   中英

Codeigniter 3 Routing Issues

I have setup a route in the routes.php file like this:

$route['videos/video'] = 'videos';

So if a user enters:

http://domain.com/videos/video/

I want it to just load the videos page which works, but the issue I am running into is that it is keeping the URL the same so when the user clicks on one of the videos from the videos page the url will look like this:

http://domain.com/videos/video/video/1

When is should look like this:

http://domain.com/videos/video/1

Is there any way to change this behavior?

Also, is there any way to hide the method in the URL?

$route['videos/video'] = "videos/index";
$route['videos/video/(:num)'] = "videos/video/$1";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM