Rommeo Posted June 6, 2010 Share Posted June 6, 2010 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/204006-why-wrong-script-works-everytime/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.