Hello,
I finally got my custom url structure working but I need special rules for the News Manager.
My .htaccess looks like this
What it does is that if the site is currently in the Czech language (the default language), a page's URL is like this
and like this
in the secondary language (English).
The problems is that the News Manager's .htaccess line are only for the default language with the default URL structure without any /en/. So after clicking onto some of the news it works only if my site is currently in the default language, if it's in the secondary, I got page not found error from the NM.
What I need is some condition I could implement into my .htaccess to make the NM posts work for both addresses (with and without /en/ in the structure).
My thought is something like this
I don't really understand how to implement these conditionals in there. My suggestion "surprisingly" doesn't work.
My current programming project is a java calculator, I'm not good at that, I'm even worse in PHP and I don't understand how .htaccess work at all. So sorry that I can't help myself with this.
I would really appreciate your help.
Thank you.
Tom
Edit://
I have just tried deleting both conditionals and just keeping both URL structures for Czech and English and it works a bit. What it does with the settings below is that after clicking onto a post on the News Manager page it switches the site to the secondary language, English, and then shows the article. Obviously it doesn't switch the language back after leaving the News manager article. If I change the order of the NM rewrite rules, nothing changes.
It would be perfect if clicking onto a post would not change the site's language. Can you help me, please?
Edit2://
I have also tried some advice from the Wiki, which is...
... and edited it for my site
And then found it that it's only for tge Lighttpd which doesn't have to be on every server, that's not good. Furthermore, I didn't have a file to write it in... sad story.
I finally got my custom url structure working but I need special rules for the News Manager.
My .htaccess looks like this
Code:
# News Manager
RewriteRule ^newspage/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^newspage/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^newspage/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^newspage/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
# End News Manager
# 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]
What it does is that if the site is currently in the Czech language (the default language), a page's URL is like this
Code:
http://mydomain.com/newspage
Code:
http://mydomain.com/en/newspage
The problems is that the News Manager's .htaccess line are only for the default language with the default URL structure without any /en/. So after clicking onto some of the news it works only if my site is currently in the default language, if it's in the secondary, I got page not found error from the NM.
What I need is some condition I could implement into my .htaccess to make the NM posts work for both addresses (with and without /en/ in the structure).
My thought is something like this
Code:
# News Manager
if ($language == 'cs') {
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]
};
if ($language == 'en') {
RewriteRule ^en/clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^en/clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^en/clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^en/clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
};
# end News Manager
My current programming project is a java calculator, I'm not good at that, I'm even worse in PHP and I don't understand how .htaccess work at all. So sorry that I can't help myself with this.
I would really appreciate your help.
Thank you.
Tom
Edit://
I have just tried deleting both conditionals and just keeping both URL structures for Czech and English and it works a bit. What it does with the settings below is that after clicking onto a post on the News Manager page it switches the site to the secondary language, English, and then shows the article. Obviously it doesn't switch the language back after leaving the News manager article. If I change the order of the NM rewrite rules, nothing changes.
Code:
# News Manager nastaveni:
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]
RewriteRule ^en/clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^en/clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^en/clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^en/clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
# end News Manager
Edit2://
I have also tried some advice from the Wiki, which is...
Code:
url.rewrite-once = (
"/test/page/test123post/(.*)" => "/test/index.php?id=test123&post=$1",
"/test/page/(.*)" => "/test/index.php?id=$1"
)
Code:
url.rewrite-once = (
"/demo/testTeeJay/plus/page/clanky/(.*)" => "/demo/testTeeJay/plus/index.php?id=test123&post=$1",
"/demo/testTeeJay/plus/page/(.*)" => "/demo/testTeeJay/plus/index.php?id=$1"
)
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
» The little I did for GetSimple