0

Im using a debian etch and apache 2, with webmin.

Mod rewrite is working on my server but when ever i use this code in my .htaccess, i get 500 error.

Options +FollowSymlinks

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} ^www.site.eu$ [NC]

RewriteRule ^(.)$ http://site.eu/$1 [R=301,L]*

I also get this error in the apache error log:

Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Any help is greatly appreciated.

2
  • You do realize that etch has no security support left?
    – ptman
    Sep 10, 2010 at 17:34
  • no i didn't know that
    – Marty
    Sep 10, 2010 at 19:03

3 Answers 3

2

Have you enabled the rewrite module?

a2enmod rewrite

4
  • Additionally, what is your AllowOverride set to in your apache config?
    – J.Carroll
    Sep 10, 2010 at 17:35
  • Yes it is enabled, when ever i use that command i get "module is already running"
    – Marty
    Sep 10, 2010 at 18:38
  • The defualt file found in /etc/apache2/sites-available is set to ON, here is a portion of it
    – Marty
    Sep 10, 2010 at 18:40
  • NameVirtualHost * <VirtualHost *> ServerAdmin webmaster@localhost <Directory /var/www//> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all # This directive allows us to have apache2's default start page # in /apache2-default/, but still have / go to the right place # RedirectMatch ^/$ /apache2-default/ </Directory>
    – Marty
    Sep 10, 2010 at 18:42
0

After you fixed that, you also have a problem with the RewriteRule. The asterisk can't stand at the end of the line. Probably it's missing after the dot so you don't only match single-letter page names.

RewriteRule ^(.*)$ http://site.eu/$1 [R=301,L]
1
  • Thanks, but i get the error
    – Marty
    Sep 10, 2010 at 18:43
0

Thanks for the info guys after browsing about i solved the problem by adding this line to the bottom of my apache2.conf file, found /etc/apache2:

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

Now it works fine :)

You must log in to answer this question.