if( count( $_POST ) < 1 ) {
// determine if this was a secure request - we use a non standard HTTPS port so the SERVER_HTTPS_PORT define should always be used in place of 443
$protocol = $_SERVER['SERVER_PORT'] == SERVER_HTTPS_PORT ? 'https' : 'http';
header( "HTTP/1.0 301 Moved Permanently" );
header( "Status: 301" ); // this is for chrome compliance
header( "Location: $protocol://".CLIENT_DOMAIN."{$_SERVER['REQUEST_URI']}" );
session_write_close();
exit;
}
Can this functionality be rewritten with .htaccess rules?
Logic:
If not a POST request, redirect to equivalent page with whole query string by issuing 301 header and status, whilst maintaining protocol.