简体   繁体   中英

Use example.com/param instead of example.com/def_controller/index/param

I need to acess my default contrillers index function without need to write a controllers name and index in the URL, but only pass the parameter value right after the domain name. Like in jsfiddle when after domain name you pass the identifier of fiddle.

How can i achive that in codeigniter site?

I guess it should be made in htaccess file.

Could somebody help me with that?

Give this a shot

RewriteEngine On
RewriteBase /
RewriteRule ^/([0-9]{8})\$ /def_controller/index/$1

There is nothing to do with .htaccess. I don't think so.

You can customize all your URL in routes.php placed on application/config .

$route['(:num)'] = 'def_controller/index/$1';

URI Routing Wildcards

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