apache2 how to rewrite to special scheme
I wonder if there’s easy way to let apache2 support URL rewrite to special schemes like “macappstore”, “itms” and so on.
RewriteRule ^/pbmac-test$ macappstore://itunes.apple.com/us/app/id420133782 [R,L]
mod_rewrite is not detecting
macappstore as a valid protocol for an absolute URI. See
is_absolute_uri in mod_rewrite.c for more details.
This leads it to treat your target URI as relative rather than absolute. The
R flag will prepend the current protocol, server name and port to the relative URIs in order to produce RFC correct redirect headers as documented.
For redirects as simple as the one you presented, you can use mod_alias instead:
Redirect /pbmac-test macappstore://itunes.apple.com/us/app/id420133782
Answered By – bd808