Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] .htaccess News Manager + I18N setup
#8
I finally got it working this morning.

To prevent the site from switching from Czech to English after clicking onto a post, I had to add &lang=cs behind every "Czech" NM line of .htaccess.

It looks like this now.
Code:
# News Manager nastaveni:

# for Czech (default language - that's important, it's without /cs/ in the url)
RewriteRule ^clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1&lang=cs [L]
RewriteRule ^clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1&lang=cs [L]
RewriteRule ^clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1&lang=cs [L]
RewriteRule ^clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1&lang=cs [L]

# for English (secondary language)
RewriteRule ^en/clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1&lang=en [L]
RewriteRule ^en/clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1&lang=en [L]
RewriteRule ^en/clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1&lang=en [L]
RewriteRule ^en/clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1&lang=en [L]

# end News Manager

And to not get any error on the title page, I had to keep both (cs|en) in the end of the .htaccess. So it looks like this
Code:
# To make custom permalinks work with the secondary language in the address only :) Permalink structure: %nondefaultlanguage%/%parent%/%slug%/
RewriteRule ^/?$ cs/ [R,L]   # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(cs|en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(cs|en)/?$ index.php?lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$2&lang=cs [QSA,L]

I don't really know why did it work for you the way you proposed it and not for me.
I'm using get_header(false) again, it's the same as the get_i18n_header except the cannonical link with "en" at the end and doesn't affect anything else.

I don't really know why does "&lang=cs" have to be in the .htaccess, it's already set up in the admin panel (see the picture above).

Never mind. Important is that your "&lang=en" and my "&lang=cs" in the NM lines helped me. That's all that was needed and now it works.

Thanks a lot Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply


Messages In This Thread
RE: .htaccess News Manager + I18N setup - by TeeJay - 2013-04-22, 16:36:43



Users browsing this thread: 1 Guest(s)