简体   繁体   中英

Url rewrite in CodeIgniter

我的 url 就像 websitename/package?some-text some-text 实际上是别名,使用这个我从 db 中获取值我想看到我的 url 像 websitename/some-text 我使用的是 CodeIgniter 框架和包是一个控制器请帮助我..

Please try by using htaccess file like below

Redirect 301 /package?some-text http://websitename.com/some-text

You can use this site for generating htaccess rules.

EDIT

Please change the content of htaccess to

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/package?some-text [NC]
RewriteRule ^.*$ /some-text#%1 [L]

EDIT - 2

You can also try to do this with in tyhe codeIgniter routes.php file, like

$route['some-text'] = "package_some-text";
$route['default_controller'] = "web";
$route['404_override'] = 'web/not_found';

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