Marc Rasmussen
Marc Rasmussen

Reputation: 20555

apache2 rewrite page not found

Ive just completed the setup of apache.

Setup looks as follow:

my virtualhost:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName system.local
    ServerAlias www.system.local
    DocumentRoot /var/www/system
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

My hosts file is:

   127.0.1.1       system.local

I have also used a2enmod to enable mod_rewrite.

When i open my application and for instance go to /Admins/index i get a page not found.

Does anyone know what i might be missing?

Upvotes: 0

Views: 36

Answers (1)

Panama Jack
Panama Jack

Reputation: 24458

If you are using an .htaccess file. You need to allow the use of an .htaccess file in your web directory using AllowOverride All. For that your code should look like this.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName learningbank.local
    ServerAlias www.learningbank.local
    DocumentRoot /var/www/system_learningbank
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /var/www/system_learningbank>
     AllowOverride All
    </Directory>
</VirtualHost>

Also don't forget to restart apache when making config changes.

Upvotes: 1

Related Questions