Is there a way to redirect with mod_rewrite without changing the URL in the user's browser?
I saw a solution using [P]
in the end of RewriteRule
, but this is not working for me.
What I want:
https://my-server.com/propostas/billy.joe
< ---> internally redirect to
https://my-server.com/subdir/propostas_usuarios/billy.joe
What I have:
<LocationMatch "/propostas/(?<username>[^/]+)">
RewriteEngine On
RewriteRule ^/([^/]+)(.*) /subdir/propostas_usuarios/%{env:MATCH_USERNAME}
</LocationMatch>
This is what is currently working. But after redirecting, I can see /subdir/propostas_usuarios
in the new URL.
I have tried to use [P]
like this:
RewriteRule (.*) https://%{SERVER_NAME}/hpe/propostas_usuarios/%{env:MATCH_USERNAME} [P]
But this gives me this errors:
[Fri Dec 11 16:02:57.945091 2020] [proxy:debug] [pid 16725:tid 140351293593344] mod_proxy.c(1253): [client 10.0.105.36:52700] AH01143: Running scheme https handler (attempt 0)
[Fri Dec 11 16:02:57.945102 2020] [proxy_ajp:debug] [pid 16725:tid 140351293593344] mod_proxy_ajp.c(744): [client 10.0.105.36:52700] AH00894: declining URL https://my-server.com/subdir/propostas_usuarios/billy.joe
[Fri Dec 11 16:02:57.945124 2020] [proxy_fcgi:debug] [pid 16725:tid 140351293593344] mod_proxy_fcgi.c(1032): [client 10.0.105.36:52700] AH01076: url: https://my-server.com/subdir/propostas_usuarios/billy.joe proxyname: (null) proxyport: 0
[Fri Dec 11 16:02:57.945131 2020] [proxy_fcgi:debug] [pid 16725:tid 140351293593344] mod_proxy_fcgi.c(1035): [client 10.0.105.36:52700] AH01077: declining URL https://my-server.com/subdir/propostas_usuarios/billy.joe
[Fri Dec 11 16:02:57.945149 2020] [proxy:debug] [pid 16725:tid 140351293593344] proxy_util.c(2338): AH00942: HTTPS: has acquired connection for (*)
[Fri Dec 11 16:02:57.945159 2020] [proxy:debug] [pid 16725:tid 140351293593344] proxy_util.c(2393): [client 10.0.105.36:52700] AH00944: connecting https://my-server.com/subdir/propostas_usuarios/billy.joe to my-server.com:443
[Fri Dec 11 16:02:57.946130 2020] [proxy:debug] [pid 16725:tid 140351293593344] proxy_util.c(2616): [client 10.0.105.36:52700] AH00947: connected /subdir/propostas_usuarios/billy.joe to my-server.com:443
[Fri Dec 11 16:02:57.946210 2020] [proxy:debug] [pid 16725:tid 140351293593344] proxy_util.c(3085): AH02824: HTTPS: connection established with 10.30.6.52:443 (*)
[Fri Dec 11 16:02:57.946233 2020] [proxy:error] [pid 16725:tid 140351293593344] AH00961: HTTPS: failed to enable ssl support for 10.30.6.52:443 (my-server.com)
[Fri Dec 11 16:02:57.946236 2020] [proxy:debug] [pid 16725:tid 140351293593344] proxy_util.c(2353): AH00943: HTTPS: has released connection for (*)
Any ideas?