Question
How do I point another domain to a sub-folder?
I tried multiple tutorials online but up to no avail.
I want to point my new domain (eg newdomain.com
) to a folder in /var/www/html/new/
.
I bought the domain off namecheap.com and have set the custom DNS to dns1-3.digitalocean.com. Next, I made the DNS changes in the Networking area in the control panel. https://i.imgur.com/9tbsT4C.png
Afterwards, I created a Apache’s VirtualHost in /etc/apacheites-available
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mew
ServerAlias newdomain.com
ServerName newdomain.com
<Directory /var/www/html/new>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
Require all granted
</Directory>
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://IP-ADDRESS/new/ Keepalive=On
ProxyPassReverse / http://IP-ADDRESS/new/
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
After restarting Apache2, my primary + new domain doesn’t seem to be loading at all.
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.
×