[ .htaccess rewrite path without changing visible URL ]
I have a link which looks like that:
www.domain.com/file.php
I want to create .htaccess entry so that if someone goes to
www.domain.com/folder/name
they would be redirected to
www.domain.com/file.php
I've created .htaccess entry which works and it looks like this:
RewriteRule ^folder/name$ /file.php [L,R=301,L]
The only problem I have is that in browser address field user sees
www.domain.com/file.php
where as I want him to see
www.domain.com/folder/name
Is it possible to do this and if so, how do I do that?
Answer 1
You don't need the redirect, that's causing it to reload the page which causes the new URL to appear in the address field. You just want to tell the server what directory path is represented by the "friendly" URL. Try this:
RewriteRule ^folder/name$ /file.php [L]