Monday, 13 June 2016

Enable htaccess if not enabled on your server

"Page Not Found" Errors on every page except homepage.

Site is hosted on digital ocean or have file structure as var/www/html/yoursite





Enabling mod_rewrite by typing following command

    sudo a2enmod rewrite

Than restart apache server by following command

    sudo service apache2 restart

Now open file /etc/apache2/sites-enabled/000-default.conf

or by typing command given below

   sudo nano /etc/apache2/sites-enabled/000-default.conf
  
Inside that file, you will find the <VirtualHost *:80>

<Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
</Directory>


after adding this your code should look like(indent shoud be proper)

<VirtualHost *:80>
    <Directory /var/www/html>

        . . .

    </Directory>

    . . .
</VirtualHost>

Now again restart server by typing command

   sudo service apache2 restart
  
Now add your htaccess and see that will work


Digital Ocean
banner
Previous Post
Next Post

0 comments: