When a user enter on (www.example.com), i need to redirect him to (www.example.com/site). But i don’t want to change the URL on the browser, I need it to be transparent.
I used mod_rewrite on htaccess file, like this:
You need to escape the dots (see backslashes in red) in RewriteConds because they are regular expressions and a dot stands for “any character” in regex. While it will work if you don’t escape it, it’s technically not correct.
Also, why do you have both the www-version and the non-www version of your site available? It’s better to pick one (doesn’t matter which one) and stick with it. Also redirect the one you don’t want to the one you do want.
Why are you escaping all that stuff? You don’t need to do that
The R=301 is what is making Apache change the URL of the browser. Drop it. Once you drop it, also remove the http:// part, because that will also force an external redirect.
If you’re on apache 1.x change ^/?$ to ^/$ . If you’re on Apache 2.x change it to ^$