CodeIgniter Forums
htaccess, routes, database, multilanguage, errordocument, is it possible to do so? - 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: htaccess, routes, database, multilanguage, errordocument, is it possible to do so? (/thread-43249.html)



htaccess, routes, database, multilanguage, errordocument, is it possible to do so? - El Forum - 07-05-2011

[eluser]Unknown[/eluser]
The situation:
i have database with table pages.
i want to get such url:

/en/producs/coffee/
/en/products/tea/
/es/prudocte/tai-niekoi/
/es/product/nieko/cia-nera (without trailing slash)

want to use only one controller to handle these url. There i would check what page to display.

But in htaccess i want to specify error documents like this:
ErrorDocument 400 /400.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

because i prefer to use static error templates.

Also should work controllers calls like this:
/index.php?c=controller1&method=method1 OR
/index.php/?c=controller1&method=method1 OR something like that.

what i tryed:
this htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php/$1 [L,QSA]

ErrorDocument 404 /404.html
</IfModule>

and

this routing
$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route[':any'] = 'content';


the problem is of this RewriteRule ^(.*)/$, when url doesnt end with / it also redirects to error page.
And such url
/?c=controller1&method=method1 OR
/index.php?c=controller1&method=method1

doesnt work too.

Anybody knows how correct to do all these things?


htaccess, routes, database, multilanguage, errordocument, is it possible to do so? - El Forum - 07-07-2011

[eluser]Unknown[/eluser]
no one?