Jump to content

Recommended Posts

My language-changing links was like this :

 

www.mysite.com/lang.php?lang=en

// lang.php script takes the value by get

// writes it to language cookie

// gives "language error" if get is empty or any other thing except "fr / en / de " and sets the cookie to default language.

//my index.php checks the cookie and uses the language in the cookie.

 

I changed it to and made a link from my index.php(template) to ;

www.mysite.com/l/en

RewriteRule ^l/([a-z-_]+)/?$ lang.php?lang=$1 [L]

 

that goes to :

www.mysite.com/lang.php?lang=en

 

it works well just when i click the "English" ( changing language) button.

 

but the problem is :

when I click the any other page (that all pages uses the template that I mentioned at the top) , it gives me "Language Error" and script sets cookie to default language so my clicking "en" does not work here. This is very interesting cause I guess, when ever I enter any page, everytime my .htaccess runs, it sends empty get value to my lang.script I guess and everytime it sets the cookie to default language, and I can not change the default language.. if it was working properly,while clicking any other page ( after clicking "en" ), the index.php ( template ) would read the cookie that is "en" and prints the layout as in the cookie (en), it would not run the lang.php everytime.

 

I dont know what can cause this,

Is there any solution for this ?

Link to comment
https://forums.phpfreaks.com/topic/204006-why-wrong-script-works-everytime/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.