E
E
Egor1Sin2018-09-02 02:59:23
CodeIgniter
Egor1Sin, 2018-09-02 02:59:23

Routing failure?

Hello colleagues!
The problem is in CodeIgniter 3, or rather in routing.

spoiler

$route['admin'] = 'admin/login'; /* не работает */
$route['blog/(:num)'] = 'blog/veiw/$1'; /* не работает */
routes.php
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['admin'] = 'admin/login'; /* не работает */
$route['blog/(:num)'] = 'blog/veiw/$1'; /* не работает */
$route['blog'] = 'blog/index';
$route['create'] = 'main/create';
$route['(:num)'] = 'main/view/$1';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'main/index';

Structure /views/
/admin/login.php
/blog/index.php
/blog/view.php
/main/index.php
/main/view.php
/main/create.php
/pages/....... .php
/pages/........php
......
Thanks in advance for your help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dmitriy, 2018-09-02
@dmitriylanets

$route['(:num)'] = 'main/view/$1';
$route['(:any)'] = 'pages/view/$1';
should be at the beginning

E
Egor1Sin, 2018-09-02
@Egor1Sin

.htaccess file

DirectoryIndex index.php
RewriteEngine on                       
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question