Arch-linux apache 404 mod_rewrite VirtualHost with url suffix

arch-linuxmod-rewritevirtualhost

I have a problem with Apache on Arch-Linux. I assume it is related to mod_rewrite, but I am not sure.

In the past I always worked with Debian-based systems. Arch seems a little different.

I have a virtual host like this, and an index.php in the respective directory. I tried with and without .htaccess.

<VirtualHost *:80>
  ServerName test.localhost
  DocumentRoot /home/me/sites/test
  <Directory /home/me/sites/test>
    Options FollowSymLinks
    AllowOverride All
  </Directory>
</VirtualHost>

When I visit http://test.localhost/ or http://test.localhost/index.php, it works ok.

When I visit http://test.localhost/foo, it gives a 404 not found.

I can add a .htaccess with ErrorDocument 404 /index.php, so Apache will open index.php and correctly follow the mod_rewrite instructions from .htaccess, but then it still has the 404 header.

Any ideas what to look for?

Best Answer

Turned out that mod_rewrite was not enabled.

In /etc/httpd/conf/httpd.conf, uncomment:

#LoadModule rewrite_module modules/mod_rewrite.so

Why did I not find this at first? Because all the url rewriting seemed to work fine, except for the 404 header.

Related Topic