Reputation: 191819
I have the rewrite rule
RewriteRule (/m)?/cia16(.*) $1/cia$2?CIA=16 [QSA]
This works fine, but the problem is that it is running as the environment of multiple hosts, but it only tries to redirect to the main host. For example, this is in the configuration for dev.example.com
, but the rewrite redirects to dev even if you are on explosion-pills.dev.example.com
(which has the same config).
I can fix that with:
RewriteRule (/m)?/cia16(.*) http://${HTTP_HOST}$1/cia$2?CIA=16 [QSA]
...however, this causes the URL to change in the address bar which is undesirable. Using the [L]
flag does nothing either.
How should I specify the rewrite rule to use the current host without changing the request URL?
Upvotes: 0
Views: 217
Reputation: 786291
One way to solve is to enable mod_proxy
in your Apache config. Once that is done use P
(proxy) flag in Rewrite like this:
RewriteRule (/m/)?cia16(.*) http://%{HTTP_HOST}$1/cia$2?CIA=16 [QSA,L,P]
Upvotes: 1