2

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 (or my_domain_name.com), I can see my website with no issues. However, the browser shows the IP address instead of www.my_domain_name.com. Almost all posts on the internet suggest that I add an A 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>
0

2 Answers 2

1

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

5
  • 1
    Thanks! 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.
    – sus
    Jan 29, 2015 at 8:53
  • Well 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.
    – Chloe
    Jan 29, 2015 at 23:37
  • It doesn't appear that your A record has been propagated to the world. No one can resolve the domain name. whatsmydns.net/#A/huwamaru.com
    – Chloe
    Jan 29, 2015 at 23:45
  • There 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?
    – sus
    Jan 30, 2015 at 20:27
  • 1
    Yes, both www.huwamaru.com and huwamaru.com should resolve to the same IP address. Add an A record to huwamaru.com and CNAME record for www 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.
    – Chloe
    Jan 30, 2015 at 21:29
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.