I have installed apache2 on my computer with Linux. I can create websites in directory /var/www/html/ so for example if I create following file:
/var/www/html/mywebsite/index.php
then my site is accessible on following URL:
http://localhost/mywebsite
How can I set website alias name, when I want to use following URL for my website
http://mywebsite.com
instead of
http://localhost/mywebsite ?
Can I set this in /var/www/html/mywebsite/.htaccess file?
(website directory /var/www/html/ is not shared on internet or any other network, it just should work on my private PC)
EDIT: It is not exactly the same problem as mentioned problem
I need not just replace domain name for IP address, but domain name with path for another domain name. I have tried to set in /etc/hosts:
<VirtualHost *:80>
ServerName mywebsite.com
# redirect elsewhere
Redirect localhost/mywebsite
</VirtualHost>
I restarted my computer but this redirect doesn't work for me.