Possible Duplicate:
redirect using htaccess file
Hello there (very simple question),
How to map
mydomain/language/somepage
To
mydomain/somepage.php
The physical page being of course mydomain/somepage.php
The idea is that /en/somepage, /fr/somepage, /de/somepage all point to somepage.php (I intend to get the language passed in URL with php).
More specifically I would like that apache understands to SUPPRESS either /fr /en /de from the request URI and deliver the right document, my physical tree not having any /fr /en /de subdirectory : i.e.
root/fr/subdir/subsubdir/somepage
should be pointing to
root/subdir/subsubdir/somepage.php
Thank you !
* EDIT *
So, I think I get a better idea how URL rewrites work so, I've come to this. It's broken and I actually suck at regular expressions so if somebody could help me sort it out I would love it ! ^^
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ^[a-z]{2}$/%{REQUEST_FILENAME}\.php -f
RewriteRule ^([a-z]{2})/(.*)$ $2.php?lang=$1
Explanations : the URL will be passed to apache in the form of
root/(fr|de|en|whatever)/document
and is (should be) rewritten in the form of/passed to php
root/document.php?lang=(fr|de|en|whatever)
I hope it's clear enough, TYVM !
Also, being able to pass subdirectories as well like
root/(fr|de|en|whatever)/sub/.../document
would be very nice. I need further explanations on htaccess for constants for this like %{REQUEST_FILENAME}, %{REQUEST_URI}, ...
TY