I am using a mod_rewrite rule to create SEO friendly URL’s.
This is my mod_rewrite rule:
RewriteRule ^portfolio/portretten$ http://www.mydomain.nl/gallery.php?g=5 [L,NC]
It works fine, if I type ‘www.mydomain.nl/portfolio/portretten’ it loads www.mydomain.nl/gallery.php?g=5. But it’s a redirect, so the address bar of my browser shows ‘www.mydomain.nl/gallery.php?g=5’, but I want it to show ‘www.mydomain.nl/portfolio/portretten’.
So I don’t want a redirect but a “replace”. Is that possible?
Yes—you can either drop the http://www.mydomain.nl part (in which case it’ll default to doing an internal redirect) or alternatively add P (proxy) to your flags.
Actually, it should work even with the domain in there, but your Apache must not realize that is the current host. Either that, or it isn’t the current host, in which case you’ll have to use proxy.
The mod_rewrite documentation goes over all the flags.