繁体   English   中英

.htaccess文件和Codeigniter中的uri路由不起作用

[英].htaccess file and uri routing in codeigniter not working

我的主要网址: http:// localhost:8080 / courses / Content / index / rd-sharma-solutions / class-12 / chapter-3-binary-operations / exercise-3-1

我希望我的网址是: http:// localhost:8080 / courses / rd-sharma-solutions / class-12 / chapter-3-binary-operations / exercise-3-1

这是我的routes.php文件

$route['default_controller'] = 'Admin';
$route['404_override'] = '';
$route['translate_uri_dashes'] = TRUE;
$route['index'] = 'Content/index';

这是我的.htaccess文件,位于项目->应用程序-> .htaccess中

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|assets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

我的项目结构

我需要有关URI路由的帮助,并希望缩短url,也想删除文件夹名称。

试试这个

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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