domain name redirecting, but changes to IP address

When I am typing my domain name in the browser, it redirects to my server. Also, loads the page. But, in the browser, the domain name changes to the IP address of the server. I want it to show the domain name.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello team,

Even I am also facing the same issue with Magento, When I hit the domain name it directly redirects to IP address.

<VirtualHost XX.XX.XX.XX>

DocumentRoot “/var/www/html” #ServerName

Other directives here

RewriteEngine On RewriteCond %{HTTP_HOST} !^$ RewriteRule /.* [R]



I am using the one click Magento installer image of Digital ocean. I believe it is running Apache. I tried to find .config file in Magento, but I am not really sure where to find.

If you’re using WP or any other CMS application, then probably you might have used IP address for the domain name while installing the application. That is why it is redirecting to IP address. To resolve the issue make changes in .config file and replace IP address with your domain name.