0

On my domain lapagept.com, I have create a subdomain sm.lapagept.com.

When a user enters http://sm.lapagept.com in his browser's address bar, he is redirected to http://173.209.38.131/~sm. The new address in the address bar is changed for http://173.209.38.131/~sm.

Here is the code we use in the .htaccess file on lapagept.com to make this :

RewriteEngine on

RewriteCond %{HTTP_HOST} ^sm\.lapagept\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.sm\.lapagept\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/173\.209\.38\.131\/\~sm" [R=301,L]

My question :

When a user enters http://sm.lapagept.com in his browser's address bar, would it be possible to get redirected to http://173.209.38.131/~sm but to keep http://sm.lapagept.com in his address bar?

La Page PT
  • 571
  • 1
  • 6
  • 20

1 Answers1

1

It's not possible, for security reasons.

There are ways to update the URL in the client's browser address bar without reloading the page, but it doesn't apply to your case because you're trying to change the domain part of the URL.

I would recommend

  1. setting up your DNS provider to direct requests to sm.lapagept.com to 173.209.38.131
  2. setting up your web server at 173.209.38.131 to accept and server requests for the domain sm.lapagept.com. If you're using apache, this can be done by using the ServerName, ServerAlias properties in your VirtualHost settings.
Aurélien Gasser
  • 3,043
  • 1
  • 20
  • 25
  • 1
    You can if you configure Apache as a reverse proxy. (If this IP is actually the same server - not clear from the question - then you wouldn't even need to do this.) – MrWhite Jun 28 '17 at 15:32