0
votes

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

1
try this (hope it will help): <VirtualHost *:80> DocumentRoot "/var/www/html/mydomain.com/public_html" ServerName mydomain.com </VirtualHost> then restart webserver (only for checking)user4486345
"...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
did you restart your apache2 : sudo service apache2 restart or /etc/init.d/apache2 restartCodeIsLife
Yes I had to rewrite a2enmod and then restart apache server. Then it started working. Thanksskool99

1 Answers

1
votes

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