I’m trying to configure virtual host in apache2 in ubuntu instance hosted with aws and successfully redirected the requests to the appropriate website.
Further clicking on the links on the index page changes the url in the browser to ip/mydomain.com/uri where i expect it to be mydomain.com/uri.
Here are the things i’ve done
- Purchased mydomain.com from GoDaddy
- Edited A record to ip (public ip of the aws instance)
- Hosted ubuntu instance with aws and installed apache2,php,mysql
- Created a site with wordpress and installed on the aws instance
- Configured Virtual Host Entries under /etc/apache2/sites-enabled/mydomain.com.conf
DirectoryIndex index.php index.cgi index.html
ServerAlias My Domain
SetEnv VAR_IF_YOU_NEED_ONE VALUE
And enabled the site and restarted apache using the following commands
$ sudo a2ensite mydomain.com.conf $ sudo service apache2 restart
Expected and Actual Behaviour
- www.mydomain.com should load http://ip/mydomain.com/index.php (Working Fine)
- Clicking on the internal link say contactus should redirect and url should be www.mydomain.com/contactus, but now it is http://myip/mydomain.com/contactus
Thanks for any references and support on this.
Note: I’m pretty new to this area so incase you feel this question is not clear kindly suggest improvements on comment before downvoting. That will help me improve this.