TAGS :Viewed: 3 - Published at: a few seconds ago

[ .htaccess rewrite path without changing visible URL ]

I have a link which looks like that:


I want to create .htaccess entry so that if someone goes to


they would be redirected to


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


where as I want him to see


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]