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

时间:2018-11-22 10:44:52

标签: php .htaccess codeigniter-3

我的主要网址: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 文件,位于 project-> application->。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]

My Project Structure

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

1 个答案:

答案 0 :(得分:0)

尝试这个

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