httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marat Khalili <>
Subject Re: [users@httpd] How to customize error responses (while using mod_rewrite)?
Date Tue, 16 May 2017 00:54:10 GMT
Just in case you are stuck, you can always use internal redirect to a CGI script (or PHP or
whatever) and write whatever response you want with that script. It's kind of cheating but
it should work.

With Best Regards,
Marat Khalili

On May 15, 2017 5:46:52 PM GMT+03:00, Jens Schleusener <>
>my general question is how I can generate customized error responses 
>while using the mod_rewrite module. Yes, I know the page
>but the ErrorDocument directive allows only to do some customization
>status code optionally refined by context but I want to output
>error pages specifically for many different request conditions
>mainly by various RewriteCond directives.
>Here an actual special example: On a server running httpd 2.4 I want to
>disallow the HTTPS access using the TLSv1.0 protocol. To order do that
>too "hard" but a little bit client-friendly TLSv1.0 accesses aren't yet
>really disabled but redirected for a limited period to an according 
>information page. Currently that is realized with the following 
>  RewriteCond %{SSL:SSL_PROTOCOL} ^TLSv1$
>  RewriteRule (.*) /https_tlsv10.html [R=permanent,L]
>The big disadvantage of that solution is that it returns an obviously 
>incorrect HTTP response status code 301 ("Moved Permanently") but I
>that the server returns an appropriate 4xx or 5xx status code (ok, I am
>sure what would be an "appropriate" one). By the way, the current 301 
>redirection let some bots (using still TLSv1.0) nevertheless access
>information page many thousand times (but maybe they would that do also
>with a returned 4xx or 5xx response status code).
>Unfortunately for the RewriteRule directive for e.g. a Rewrite flag
>instead of R=permanent isn't allowed (only 300-399, why?) so I had 
>considered the usage of the <If> directive but didn't find a working 
>So maybe the only working solution is the detour via an external CGI 
>Probably I have something overseen, so any ideas or comments?
>To unsubscribe, e-mail:
>For additional commands, e-mail:

View raw message