Score:0

masking URL after redirection

us flag

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.

in flag
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](https://serverfault.com/questions/1099097/masking-after-redrection-using-htaccess), what you want is not possible using rewrites, you need to configure Apache as a reverse proxy to do that.
in flag
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.
vidarlo avatar
ar flag
Don't run your http server on port 8081, and configure DNS the way you want it.
pl flag
Rewrite will only change the file path part of the URL, not the host/port information.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.