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]

http://TLD/pbmac-test will be rewrote as http://TLD/macappstore://itunes.apple.com/us/app/id420133782


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

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More