Is something like this possible in Apache ... (i.e. redirect to an external url with the path causing the 403 error passed along)
ErrorDocument 403 http://www.sample.com/{{REDIRECT_URL}}
ErrorDocument
configuration option, unfortunatelly, doesn't support server variables expansion. What you can try is to use local script, that will issue redirect for you.
ErrorDocument 403 /cgi-bin/error.cgi
Note, that script has to be local, otherwise you won't get REDIRECT_*
variables passed. And in the script itself you can issue redirect statement:
#!/usr/bin/perl
my $redirect_status = $ENV{'REDIRECT_STATUS'} || '';
my $redirect_url = $ENV{'REDIRECT_URL'} || '';
if($redirect_status == 403) {
printf("Location: http://%s%s\n", 'www.sample.com', $redirect_url);
printf("Status: %d\n", 302);
}
print "\n";
See Apache documentation for more insights http://httpd.apache.org/docs/2.4/custom-error.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With