0

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 mydomain@gmail.com
   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

skool99
  • 780
  • 1
  • 16
  • 35
  • try this (hope it will help): ` DocumentRoot "/var/www/html/mydomain.com/public_html" ServerName mydomain.com ` then restart webserver (only for checking) –  Feb 14 '16 at 08:32
  • "...the site homepage shows up ...": probably your virtual host config is ok. Possibilities of the failure could be the addressing of links (hrefs) and base href entries in your HTML code. Please show us a HTML example of your homepage. – hherger Feb 14 '16 at 09:33
  • did you restart your apache2 : sudo service apache2 restart or /etc/init.d/apache2 restart – CodeIsLife Feb 14 '16 at 23:41
  • Yes I had to rewrite a2enmod and then restart apache server. Then it started working. Thanks – skool99 Feb 14 '16 at 23:46

1 Answers1

1

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
skool99
  • 780
  • 1
  • 16
  • 35