Alain R. wrote:
if i use apache .htaccess to rewrite address, it still do not understand
how it makes my life easier.
for example, if user run page www.myweb.com/index.php?l=en and in my
.htaccess i have rewrote index.php?l=en to be rewritten as
www.myweb.com/en/index.php, it means that in my index.php i must use a
regex to extract /en/ variable and to convert it to a $lang variable for
instance.
so isn't it easy to use www.myweb.com/index.php?l=en.
You have it backwards.The RewriteRule would direct requests such as:
/en/whatever
/fr/whatever
/es/whatever
to:
/your_script.php?l=en (or ?l=fr, etc.)
From there, your script need only extract the language param from
$_GET['l'].
If a request was made directly like /your_script.php?l=fr then the
RewriteRule would not be used, because the condition was not met. So, in
this case, there would be absolutely no difference from the perspective
of the script. The only difference, as far as the *request* goes, is
that mod_rewrite has nothing to do with it.
> what does such rewriting makes my life better ?
> is it only such tip for search engine better referencing ?
Mostly, yes. There's also the advantage that your script may be
rewritten to accept the language param in other ways (?lang=fr, ?foo=fr,
etc.) and the URL needn't change, just the RewriteRule.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php