I want to see how to redirect localhost or local IP to a domain name locally… I have a Apache web page hosted locally and I want people in my LAN to access it via something like example.com instead of my IP… Any help??
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!
Hi @binukpremaratne,
You need to create a redirect in your Apache Configuration file for your IP/default config.
This is not a standart setup so you won’t be able to find the exact tutorial. Having said that, you should be able to cdit the VirtualHost file of your local IP config to something like that:
<VirtualHost 10.0.0.1:80>
ServerName servername.com
.....
RewriteCond %{SERVER_NAME} 10.10.10.1
RewriteRule /(.*) http://servername.com/$1 [R=301,L]
</VirtualHost>
Alternatively, you can create an .htaccess file in the folder your app is at and have it redirect to a domain name.
Have in mind that most probably redirecting it to a Domain won’t work as you expect as it would require a lot of configuring to make the Domain work for LAN network the way you want.
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.