I am trying to match certain rules Only when there is no “locale” in the query string
Here is how i am doing it:
RewriteCond %{QUERY_STRING} !locale
RewriteRule ^acceuil$ home.php?locale=fr [NC,L]
... (More rewrite rules)
Basically i want /acceuil to go to home.php?locale=fr (Working perfect)
Except that if somehow a link was like this /acceuil?locale=en i would like to make it go instead to /home which is equivalent to home.php?locale=en
Any chance to rewrite lets say “/acceuil” in the following way :
if(isset($locale)) {
go to home.php?locale=$locale
}
else{
go to home.php?locale=fr
}
Also i am wondering if the condition should be copy pasted before each rule ?
Please let me know if this is possible, and how i can get it going, if you have some useful reference for htaccess rewrites please share 🙂
Thanks
Here’s a generic rule that should work, and that makes sure the variable in the GET is
locale(notlocaleeeneitherllllocale):Note: if it’s French then it’s
Accueil, notAcceuil🙂