Browser shows IP address instead of my domain name when using Google Cloud
Solution 1
Are you running just the one site from Google Cloud? If you're using the default Apache config, on some distros it will set up one virtual host using the IP address as the name. Any other requests would be then diverted to that default virtual host, hence you end up at your IP address.
Solution 2
If you type in your domain, and it ends up on your IP, then that means it's being redirected. Look for a .htaccess file or a setting in Google cloud which is redirecting it. Perhaps Google cloud needs to be told what domain it will be serving for your IP? Use curl -I www.example.com
to see the headers and redirects
Related videos on Youtube
sus
Updated on September 18, 2022Comments
-
sus over 1 year
I recently bought a domain name from GoDaddy. I have a web server running in Google Cloud with a static IP. In the DNS configuration in GoDaddy, I added an
A
record (@
-> To the static IP of the Google Cloud server) and also a CNAME record for www to point to@
.When I go to
www.my_domain_name.com
(ormy_domain_name.com
), I can see my website with no issues. However, the browser shows the IP address instead ofwww.my_domain_name.com
. Almost all posts on the internet suggest that I add anA
record, which is already added in my case.Update:
Here is what I get when I issue
curl -I www.mydomain.com
:HTTP/1.1 302 Found Date: Thu, 29 Jan 2015 08:47:43 GMT Server: Apache/2.2.22 (Debian) X-Powered-By: PHP/5.4.36-0+deb7u3 Set-Cookie: osclass=j20ouo6i8lvmmu88rf68j6clp7; path=/; HttpOnly Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Location: http://130.211.241.199:/ Vary: Accept-Encoding Content-Type: text/html
And this is the content of my .htaccessfile.
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
-
sus over 9 yearsThanks! I updated the question with curl output and htaccess file contents. Could you please have a look and let me know whether they look OK? I am fully new to web hosting and does not understand much of it.
-
Chloe over 9 yearsWell I'm not too familiar with Google Cloud so I don't know the options for it, but it is definitely redirecting to the IP address because of this line:
Location: http://130.211.241.199:/
. It's not because of your.htaccess
but there might be an option in the admin panel to cause this. -
sus over 9 yearsThere has been an issue with huwamaru.com, www.huwamaru.com worked. If you check now, both of them work. Should't the name server resolve the domain name to IP address, so that the browser can find the host?
-
Chloe over 9 yearsYes, both
www.huwamaru.com
andhuwamaru.com
should resolve to the same IP address. Add an A record tohuwamaru.com
and CNAME record forwww
subdomain to point to@
(which means the root domain, huwamaru.com). Try to update your question with a screen shot of the DNS host configuration screen.