I have the following virtual host in /etc/apache2/vhosts.d/ip-based_vhosts.conf:

<VirtualHost test.local:80>
ServerAdmin webmaster@test.local
ServerName test.local
DocumentRoot /home/web/test.net/html

ErrorLog /var/log/apache2/test-error.log
CustomLog /var/log/apache2/test-access.log combined

HostnameLookups Off
UseCanonicalName Off
ServerSignature On

<Directory "/home/web/test.net/html">
  Options Indexes FollowSymLinks
  AllowOverride All

  <IfModule !mod_access_compat.c>
  Require all granted
  <IfModule mod_access_compat.c>
  Order allow,deny
  Allow from all
  DirectoryIndex index.php
<IfModule proxy_fcgi_module>
  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://$1

And in /home/web/test.net/html I have:


<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^(.*)$ index.php [QSA,L]


<?php echo $_SERVER['REQUEST_URI']; ?>

When I visit http://test.local I get correctly "/" (without quotes).

But when I visit anything else, e.g. http://test.local/abc I get a 404 page instead of "/abc".

How can I solve this to work properly?


You should check:

  • whether the .htaccess file has proper permissions
  • whether mod_rewrite is enabled
  • Thank you! mod_rewrite was disabled. After enabling it everything works fine. – george Jan 6 '17 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.