Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] .htaccess News Manager + I18N setup
#3
(2013-04-22, 05:05:28)Carlos Wrote: I suppose it can be done in a better way (I don't know much about rewriterules), but after doing some tests, this works for me:

Code:
#...
# News Manager
# default language:
RewriteRule ^clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
# English:
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

# Permalink structure %nondefaultlanguage%/%parent%/%slug%/ with Czech (cs) as default language
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(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]

# end of .htaccess file

News Manager's "Posted on ..." and "Go back to previous page" strings are always displayed in the default language, however. But links to posts work in both languages (without patching NM!)
Thank you, that's nice that you set that up directly for my lang choice.

I tried your setup exactly as you proposed (I copied that) and there are still some errors you 1) didn't have, or, 2) failed to notice.

If the site is set to be in English, everything is ok. However, if it's in Czech, the title page switches me to English and can't be switched back to Czech until leaving the title page. Furthermore, the same happens with a post. When I click onto any of the posts, I'm switched to English and switching into Czech returns me to the page with the posts list and excerpts (clanky).

Of course I don't have the NM patched, don't you worry. I had better checked the functions.php once more and it's not applied, so it's correct.

Edit://
If I add

RewriteRule ^/?$ cs/ [R,L] # optional

in above the permalink structure setup in the .htaccess I get "Page not found" like from the NM.
This RewriteRule adds /cs/ to your title page URL and makes your site Czech (after visit with the root url) until you manually switch to English.
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, 05:57:48



Users browsing this thread: 2 Guest(s)