Reputation: 621
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?
Upvotes: 0
Views: 245
Reputation: 3120
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
sm.lapagept.com
. If you're using apache, this can be done by using the ServerName
, ServerAlias
properties in your VirtualHost settings.Upvotes: 1