簡體   English   中英

使用example.com/param代替example.com/def_controller/index/param

[英]Use example.com/param instead of example.com/def_controller/index/param

我需要訪問默認的contrillers索引函數,而無需在URL中編寫控制器名稱和索引,而僅在域名之后傳遞參數值。 就像在jsfiddle中一樣,在域名后您傳遞小提琴的標識符。

我如何在Codeigniter網站上達到目標?

我猜應該在htaccess文件中進行。

有人可以幫我嗎?

試一下

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

與.htaccess無關。 我不這么認為。

您可以在application/config上放置的routes.php自定義所有URL。

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

URI路由通配符

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM