Redirect port / port 10000 to https apache

I have been reading around and trying different configurations to get a request to my server on port 10000 to redirect a http to a https request.

For some reason I can't figure out how to make it happen when i use port 10000 although i can set a rewrite rule for port 80 (implicit) to do it:

All I want is a request as follows:

http://example.com:10000

to redirect me to

https://example.com:10000

My current, vhost, the last of many different attempts is currently set as follows, but it doesn't seem to work at all:

<VirtualHost *:10000>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_POST}%{REQUEST_URI}

ErrorLog "/var/log/httpd/webmin-redirect_error_log.log"
CustomLog "/var/log/httpd/webmin-redirect_access_log.log" common
</VirtualHost>

I'v also tried a few other things but nothing seems to work, any help would be appreciated.

EDIT: I already have a re-write in my httpd.conf that redirects port 80 to https. If I access port 10000 externally it is redirected to https, but from the lan "http://192.168.0.2:10000" it doesnt.


You have to decide whether port 10000 is HTTP or HTTPS. For HTTPS you will have to create a virtualhost of it's own with SSL* configuration lines. You cannot have both in the same IP in the same port.