1

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?

donquixote
  • 491
  • 1
  • 4
  • 14
  • I don't exactly get your problem. Sending a 404 header with the redirect to index.php is what Apache's supposed to do when you're using an internal redirect with the ErrorDocument directive. – etagenklo Jan 13 '15 at 08:10
  • On Debian it would go into the .htaccess without a 404. Or at least, it would not send a 404 with the response. The ErrorDocument directive was not necessary, it would still go to index.php. Now on Arch it shows the Apache native error document, if I don't add the ErrorDocument directive in .htaccess. – donquixote Jan 13 '15 at 13:51

1 Answers1

2

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.

donquixote
  • 491
  • 1
  • 4
  • 14