htaccess rules for languages
htaccess rules for languages
Is there scope to place the language part of the url at the end of the string using htaccess?
I want clean url's using htaccess and would like to use the lang as a session parameter instead of it being included in the url..
here is what I have at present:
RewriteRule ^(.*)/(.+)$ index.php?hl=$1&page=$2 [QSA]
Which produced a clean url lke so http://www.mydomain.com/en/parent/child/child/
Is there a way of rewriting the url like this using htaccess so that it produces the below structure?
http://www.mydomain.com/parent/child/child/?hl=en or if no param is given it displays the default language anyway.
Look forward to hearing anyones thoughts on this.
I want clean url's using htaccess and would like to use the lang as a session parameter instead of it being included in the url..
here is what I have at present:
RewriteRule ^(.*)/(.+)$ index.php?hl=$1&page=$2 [QSA]
Which produced a clean url lke so http://www.mydomain.com/en/parent/child/child/
Is there a way of rewriting the url like this using htaccess so that it produces the below structure?
http://www.mydomain.com/parent/child/child/?hl=en or if no param is given it displays the default language anyway.
Look forward to hearing anyones thoughts on this.
Re: htaccess rules for languages
Would it be OK if links looked llike ?
EDIT: To have mixed url you have to edit at least one code file and .htaccess, so do backup first. Two files only guides what has to be done. If you don't know how to use them - better keep existing file and url configuration.
Code: Select all
/how-cmsms-works/pages-and-navigation/hl=en_US
- Attachments
-
[The extension txt has been deactivated and can no longer be displayed.]
-
[The extension txt has been deactivated and can no longer be displayed.]
Last edited by Peciura on Wed Mar 31, 2010 2:55 am, edited 1 time in total.
Re: htaccess rules for languages
I get an extra / in my url so it reads mydomain.com/parent/child/child//hl=en
Is there a way to get rid of this?
.htaccess has the starting folder as / wondering if this is the cause or not?
Is there a way to get rid of this?
.htaccess has the starting folder as / wondering if this is the cause or not?
Re: htaccess rules for languages
I assume you changed code already and you know what that means.
If you want to go further - modify variable "$mletail", you know where.
If you want to go further - modify variable "$mletail", you know where.
Re: htaccess rules for languages
Hi there,
thanks for reply.. spoke to you on the IRC and discovered the reason for the above was that in the config my page type was a "/" so there was always an extra one at the end.. removed page extension and now url looks good!
As mentioned on IRC the Lang switch link reverts to the default method.. is there a way of targetting the $lang param as well so that when we switch from one language to the other the url structure is retained in the new way?
thanks for reply.. spoke to you on the IRC and discovered the reason for the above was that in the config my page type was a "/" so there was always an extra one at the end.. removed page extension and now url looks good!
As mentioned on IRC the Lang switch link reverts to the default method.. is there a way of targetting the $lang param as well so that when we switch from one language to the other the url structure is retained in the new way?
Re: htaccess rules for languages
hello.
I have website in two languages. I want to do load page with lang after the diagnosis of the user's browser language. htaccess should look like?
For example, a user of the Polish language the browser loads the page domena.pl / pl / index.html.
I have installed CMS MS 1.6.6 mle
OR:
How to implement in index.php code this solution?
http://forum.wpml.org/topic.php?id=415&page=2
Please help.
I have website in two languages. I want to do load page with lang after the diagnosis of the user's browser language. htaccess should look like?
For example, a user of the Polish language the browser loads the page domena.pl / pl / index.html.
I have installed CMS MS 1.6.6 mle
OR:
How to implement in index.php code this solution?
http://forum.wpml.org/topic.php?id=415&page=2
Please help.
Last edited by requish on Tue Apr 20, 2010 6:52 pm, edited 1 time in total.
CMS Made Simple! Best CMS!
Re: htaccess rules for languages
Read this post to get the idea how language is set in CSMms-mle-fork. http://forum.cmsmadesimple.org/index.ph ... #msg204700 .You can write function that checks user preference first and than overides other variables. Try in "/config.php" first.
Re: htaccess rules for languages
I am weak in programming. forgive me. where do I replace the line of code? I understand that I enter $_SERVER['HTTP_ACCEPT_LANGUAGE'], but where? how it should look like?Peciura wrote: Read this post to get the idea how language is set in CSMms-mle-fork. http://forum.cmsmadesimple.org/index.ph ... #msg204700 .You can write function that checks user preference first and than overides other variables. Try in "/config.php" first.
--
Anybody can help?
Last edited by requish on Wed Apr 21, 2010 7:14 pm, edited 1 time in total.
CMS Made Simple! Best CMS!