Home Redirection url:port to the same url:different-port
Reply: 1

Redirection url:port to the same url:different-port

Satrapa Published in 2017-12-07 19:46:33Z

I spent 5 days looking for both Google and here a solution but there must be something that escapes me or I do not understand and therefore I do not.

I will explain it in detail. I want to redirect all the requests of a url:port to the same url but with another port sameurl:port. Example: example.com:9717 to example.com:15617

I have tried various methods in .htaccess and with proxypass in the vhost without success.

Currently the requests are directed to:


And I want to redirect all the traffic to a new port:


The problem is that I can redirect the port with htaccess or proxypass but it does not redirect the private-key data, so when it receives the requests in the new port it gives an error indicating that the private-key does not exist or is not correct. I guess that's because the redirect does not send it, or it does not do it correctly. The private key is essential since without it the user can not access.

Could someone please tell me the solution or put me on the right path?

Examples that I have used:

NameVirtualHost IP:15617
<VirtualHost IP:15617> 
    ServerName example.com 
    ServerAlias www.example.com
    DocumentRoot /var/www/data
    ProxyRequests off 
    ProxyPass / http://IP:9713/ 
    ProxyPassReverse / http://IP:9713/  

RewriteCond %{HTTP_HOST} ^example.com:9713$ [NC]
RewriteCond %{SERVER_PORT} ^9713$
RewriteRule ^(.*)$ http://example.com:15617/$1 [L,R=302]

RewriteCond %{REQUEST_URI} ^\/$
RewriteRule .* http://example.com:15617/ [R=301,L]

RewriteCond %{HTTP_HOST} ^example.com:9713$ [NC]
RewriteCond %{SERVER_PORT} ^9713$
RewriteRule ^(.*)$ http://example.com:15617/$1 [L,R=302]

RewriteCond ${SERVER_PORT} 9713/$1
RewriteRule ^(.*)$ http://example.com:15617/$1 [QSA,L]

I have tried more options but I do not add them for not making the question too long. I know something escapes me, but I can not understand or find what it is.

Thank you very much and excuse my English, it is quite poor.

Cupcake Protocol
Cupcake Protocol Reply to 2017-12-07 21:35:55Z

On port 9713, you want that virtual host to redirect to port 15617, right? So something like this:

<VirtualHost *:9713>
  ServerName example.com
  ServerAlias www.example.com
  RedirectMatch /(.*) http://www.example.com:15617/$1
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.363057 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO