What could cause my site to redirect to its IP address using Apache2?

What could cause my site to redirect to its IP address using Apache2? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the What could cause my site to redirect to its IP address using Apache2? error on your web browser. Problem :


I've been playing around with various web configurations in Debian for about a year now. I've set up DNS for a fow domains in the process and have never really had an issue. I:




  • Go to Google domains and point the DNS at my ip

  • Go to digital ocean and do the same thing

  • Set up Server Name and Server Alias in my sites-available config file



Then I'm off to the races.



However this time around after doing those things, my site will resolve if I use the domain name, but the URL changes to show the IP address once the page has loaded.



I don't even know how this could happen or what information someone would need to know what's causing it. What could be going wrong?


Solution :


... but the URL changes to show the IP address once the page has loaded.




This is only possible via post javascript processing of the page. Somewhere in the javascript code, there is a line instructing the web browser to replace the contents of the address bar with the IP address.



The only other possibility is that your web browser may contain a virus or it might have been created poorly.



If however you worded your question wrong and you're trying to say "the URL in the address bar changes to the IP address before the page has finished loading" then you have an HTTP response from accessing the URL itself that indicates a redirect to the IP address.



Go to redbot.org and put in http:// followed by your domain name (no spaces) and press enter to see results.



If the first line of the response starts with any of the following:



HTTP/1.1 301
HTTP/1.1 302
HTTP/1.0 301
HTTP/1.0 302


Then its redirecting to another URL which is listed next to the line beginning with:



Location:


That URL is likely the IP address you're complaining about.



If you want to investigate more, you can visit webpagetest.org and put in your domain there and in the results, access the waterfall section (where you see how long each request takes) and if you see yellow bars, then that means at least one redirect to another URL happened.


We hope that this article has helped you resolve the domains, redirects, apache2 error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=