0

I re-post my question in the event that I will be more clear as to what I would like to do. I have a subdomain under a dns name, lets say it is mysub.domain . This subdomain is in a remote provider where I have no apache2 control. The file system available has an index.html file that can redirect to a web page (just one html page), lets say to mycomplex.dns.site:8081. This latter site resides in an rpi that I have full control ie Apache2/php/etc. The redirection is done successfully via <meta http-equiv="refresh" content="0;url=http://mycomplex.dns.site:8081" /> in my index.html.

To summarize, I write mysub.domain in the URL command line and after the redirection I see http://mycomplex.dns.site:8081 in the url line. That is not what I want. I would like to keep showing mysub.domain. How do I do this? I googled and found this solution involving .htaccess:

RewriteEngine On
RewriteRule "^/mycomplex.dns.site:8081$" "http://mysub.domain/intex.html" [R]

This doesn't work , I keep getting the url as mycomplex.dns.site:8081. Is it some misspelling in the .htaccess file or I am missing the point of masking? I suppose that this .htaccess is in the target directory /var/www/html/ Should I add the server name mysub.domain in apache2 virtual config file, but again I tried this and it didn't work.

  • Please don't just repost your question when it get's closed. You can edit your question to improve it and it can be reopened. As you were already told, what you want is not possible using rewrites, you need to configure Apache as a reverse proxy to do that. – Gerald Schneider Apr 22 '22 at 07:17
  • And since you already disclosed that the target is a raspberry pi at your home, your question is off topic for this site anyway. This site is for business environments. – Gerald Schneider Apr 22 '22 at 07:21
  • Don't run your http server on port 8081, and configure DNS the way you want it. – vidarlo Apr 22 '22 at 07:53
  • 1
    Rewrite will only change the file path part of the URL, not the host/port information. – Brahim Gaabab Apr 22 '22 at 07:56

0 Answers0