I would like to make an internal redirect from one URL to another using mod_rewrite in my .htaccess file. Currently I know how to perform the external redirect with the following:
RewriteRule ^incoming-controller/action1.*$ http://example.com/incoming-controller/action2 [R=301,L]
I want this to happen internally, so the user posts to action1 while apache internally serves the request to action2. Is this possible? I have read about the [P] flag and mod_proxy but I haven’t been able to find much documentation on how to use it properly, or if it’s useful in this situation.
Just remove the
R=301from the flag. This is what causes the external redirect.You will also need to not use the full URL like http://example.com. Just use the URI for the resource you want to redirect to.