Apache2 virtual hosts links in website no working

1.8k views Asked by At

I installed apache2 server and enabled a2ensite for my domain name. I followed link - https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts to setup virtual hosts.

Now when I type my domain name, the site homepage shows up but the links in website are not working. I get "Not found" with message "requested URL was not found on this server"

My mydomian.com.conf file is as below in /etc/apache2/sites-enabled folder

<VirtualHost *:80>
   ServerAdmin [email protected]
   ServerName mydomain.com
   ServerAlias www.mydomain.com
   DocumentRoot /var/www/html/mydomain.com/public_html
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

All the code is present in path - /var/www/html/mydomain.com/public_html

Please let me know how I can make the links on my website working.

Thanks

1

There are 1 answers

0
skool99 On

I added below in my conf file and it works now. Thanks for help.

<VirtualHost *:80>
    ...
    <Directory ...>
        AllowOverride All
    </Directory>
</VirtualHost>

>sudo a2enmod rewrite
>sudo service apache2 restart