CodeIgniter Forums
Weird routing problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Weird routing problem (/thread-55014.html)



Weird routing problem - El Forum - 10-05-2012

[eluser]Altazar[/eluser]
I have default controller Site with functions for every page which loads view elements.

Using routes I've made URIs shorter, so: http://radenko.kosic.org/en/site/music is now: http://radenko.kosic.org/en/music.

Routes.php
Code:
// URI like '/en/about' -> use default controller
$route['^de/(about|web|photo|blog|music|contact|home|impressum)$'] = 'site/$1';
$route['^en/(about|web|photo|blog|music|contact|home|impressum)$'] = 'site/$1';
$route['^hr/(about|web|photo|blog|music|contact|home|impressum)$'] = 'site/$1';

// URI like '/en/about' -> use controller 'about'
$route['^de/(.+)$'] = '$1';
$route['^en/(.+)$'] = '$1';
$route['^hr/(.+)$'] = '$1';

// '/en' and '/de' URIs -> use default controller
$route['^de$'] = $route['default_controller'];
$route['^en$'] = $route['default_controller'];
$route['^hr$'] = $route['default_controller'];
It works fine, but I have problem to redirect http://radenko.kosic.org/music (it shows 404).

I've tried things like this:

Code:
$route['music'] = 'en/$1';
and
Code:
$route['about|web|photo|blog|music|contact|home|impressum'] = 'en/$1';
but it shows 404 error when opening pages like: http://radenko.kosic.org/music.
This is my .htaccess file:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|images|robots\.txt|style)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>