How do I hide the URL change when using an apache rewrite? I have searched for hours on this issue and have decided to come here to find out the answer. So any help/clues would be greatly appreciated!
Right now I am using:
RewriteRule ^/Page/(.*)$ http://domain.com/page.cfm?pagevar=$1 [NC,L]
The problem with that is, when you go navigate to http://domain.com/Page/abc123
it works. BUT, it changes the browser url to http://domain.com/page.cfm?pagevar=abc123
,
I want it to perform that same action, but show http://domain.com/Page/abc123 as the url.
Please, any insight on this would be very appreciated! Thanks again.
First rule will redirect your ugly URL to the pretty URL format.
Second rule will internally redirect it back for the user will not see the ugly URL.
The above rules are to be used on
.htaccess
files and assumespage.cfm
is on the root of your domain folder along with the.htaccess
file.Like your examples proposes.
You need to get rid of the
http://domain.com
part of the rule's target. When you have that, it implicity redirects the browser instead of internally rewriting: