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!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.