I have a problem with Url Rewrite in my multilingual site, or better, maybe I don't understand it very well.
My original link is something like
www.mydomain.com/index.php?lang=en&s=2
I write this rule:
RewriteEngine On RewriteRule ^([^/]*)/([^/]*)\.html$ index.php?lang=$1&s=$2 [L]
and it's work. In fact if I write in the address bar
www.mydomain.com/en/2.html (smart url)
I go to the correct page with a smarter url on the address bar.
But the problem is that the link on my code is still:
<a href="index.php?lang=<?php echo $lang?>&s=2">link</a>
and when I click it, the URL on the address bar is the original, not the smart one.
I thought that the rule on htaccess would have automatically "turned" (in the address bar) all my links in something smarter without changing the original php code...but maybe I'm wrong. If I'm wrong how should I write my links in order to have smart urls but passing variables to identify languages and pages? I'm confused.
Thank you.
After rewriting URL in your .htaccess
you need also to change the URL in your page for example in given link <a href="index.php?lang=<?php echo $lang?>&s=2">link</a>
you need to remove question mark
<a href="index.php/<?php echo $lang?>/2">