Alain R. wrote:
Stut wrote:
On 14 Sep 2008, at 20:27, Alain R. wrote:
but in this case, my browser address bar will show me :
whatever.php?l=en for example.
and this is not what i want. I want that browser shows in its address
bar /en/whatever, but the page whatever.php will get the parameter l=en.
so how can i do that ?
You're still not getting it, so here it is step by step...
* User request http://yoursite.com/en/index.php
* Apache sees this request, matches the URL to a rewrite rule and
*internally* rewrites the request so it looks like
http://yoursite.com/index.php?lang=en - note that the browser does not
get told anything about this process.
* The index.php script runs, reads $_GET['lang'] to see what language
has been requested and generates the page as normal. Whenever it
creates a URI it ensures that it's created so it starts with
'/'.$_GET['lang'].'/...' to ensure the user continues with the same
language.
Hope that makes sense. Now, please Google mod_rewrite, have a play
with it on a local test server and try it. If you don't get it from
the words, get it from the play!
-Stut
sorry Stut, i maybe miss the point here but i rewrite the rule, however
when user request is http://yoursite.com/en/index.php, the browser
address bar shows http://yoursite.com/index.php?lang=en :-(
and not only http://yoursite.com/en/index.php
this is my problem :-)
I'm starting to get the feeling that you don't WANT to understand.
Here's (AGAIN) a step-by-step explenation of what happens:
1. The USER/BROWSER sends a REQUEST for page /en/index.php to the SERVER
2. the SERVER gets the REQUEST for /en/index.php and passes it on to
mod_rewrite
3. mod_rewrite checks its configuration and notices that it should
rewrite the request.
4. INTERNALLY (that is ON THE SERVER) mod_rewrite starts another REQUEST
to the NEW url (that is /index.php?lang=en)
5. the /index.php scripts is executed, sees that it got $_GET['lang'] =
'en' and does whatever it wanted to do
6. the PHP script outputs all data it wanted to
7. the USER/BROWSER recieves all the data the PHP script put out.
8. the USER/BROWSER still THINKS it requested /en/index.php, it DOES NOT
KNOW that INTERNALLY (ON THE SERVER) this request was changed.
I hope you finally understand it now. Otherwise, I really don't know how
to get trough to you.
- Tul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php