Report this

What is the reason for this report?

como redigio mi ip al dominio

Posted on November 26, 2020

disculpe pero como hago para que si alguien sepe la ip le rediriga al dominio por ejemplo pone la ip -> 17.1321.1231.1 -> se vaya a example.com y no se quede en 12-23-1.132



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!

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.

Hi @proyectszonaentrenamient,

You can achieve this with a rewrite in an htaccess file in your DocumentRoot directory. Go to the folder

/etc/apache2/sites-available

In the folder, you should have a configuration file named 000-default.conf. You will need to be sure that your 000-default.conf file has AllowOverride All set for the DocumentRoot directory so the settings in your htaccess file will be used. Then you will want to create an .htaccess file in that directory with the following (replacing the IP and domain with your own):

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^12\.34\.56\.789$
RewriteRule ^(.*)$ http://www.domainname.com/$1 [L,R=301]

once this is done, make sure the rewrite module is enabled:

a2enmod rewrite

and restart apache

service apache2 restart

Regards, KFSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.