Welcome Guest, Not a member yet? Register   Sign In
Need help with bi-lingual site and gzip-compression
#1

[eluser]Unknown[/eluser]
I'm setting up a German Korean dictionary with Codeigniter and need some help concerning gzip compression and redirection.

I enabled compression in the config file:

Code:
$config['compress_output'] = TRUE;

but the PageSpeed Plugin tells me that there is no compression enabled/activated.

In this forum I found out that this may happen if there is something like a splash page. For my Site I set up a .htaccess file where the User ist redirected according to his browser language:

Code:
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteCond %{REQUEST_URI} !^(de)/$
RewriteRule ^$ /de/ [L,R=301]

RewriteCond %{HTTP:Accept-Language} ^ko [NC]
RewriteCond %{REQUEST_URI} !^(ko)/$
RewriteRule ^$ /ko/ [L,R=301]

I also changed my settings in the route.php file:

Code:
$route['^(de|ko)$'] = $route['default_controller'];

In the config File I specified my base url as follows:

Code:
$config['base_url'] = 'http://www.mysite.de/';

I played around with the settings and found out that CodeIgniters gzip compression is really working, if I change my base_url to something like

Code:
http://www.mysite.de/de/

or

Code:
http://www.mysite.de/ko/

But I can't change the base url to this. Everything will mess up then. I just came to the conclusion that compression is not working because of the redirections and/or because of the base url settings. (after redirecting the base_url will always have a uri segment like "de" or "ko" and never reaches the base url like www.mysite.de)

Has someone an idea what I can do?

Thank you very much in advance and sorry for my bad Englisch, Tobias
#2

[eluser]Unknown[/eluser]
Would it possible to add the language key to the base_url dynamically in the config file like this?

Code:
if($this->uri->segment(1) == 'ko') {
    base_url() = http://www.mysite.de/ko/
}
else {
    base_url() = http://www.mysite.de/de/
}

Maybe it's not possible to use the uri-class in the config file?

Until now I add the Language Key / Language URI-Segments to every anchor/link in my scripts manually www.hanmadi.de. Everything really works fine with CodeIgniter, but I don't know how to activate CIs compression for my site due to the 301 redirections.

If I add the language key to the base_url() like described above, I would have to substract them from my existing urls.

Any suggestions? Thank you. Tobias




Theme © iAndrew 2016 - Forum software by © MyBB