.htaccess: Illegal option RewriteEngine (solved)


Hi, this is my ambient: Operating system Ubuntu Linux 12.04.1 Webmin version 1.610
Virtualmin version 3.98.gpl GPL

I've problems to get RewriteEngine to work for my virtual server, let's call it.... vserver From the shell, with the command $ sudo a2enmod rewrite I can see the module is enabled

My virtual server PHP script execution mode is FCGId (run as virtual server owner).... not sure if this is important for my problem.

The content of the file /etc/apache2/sites-available/vserver.mydomain.com.conf is the following

SuexecUserGroup "#1023" "#1023"
ServerName vserver.mydomain.com
ServerAlias www.vserver.mydomain.com
ServerAlias webmail.vserver.mydomain.com
ServerAlias admin.vserver.mydomain.com
DocumentRoot /home/vserver/public_html
ErrorLog /var/log/virtualmin/vserver.mydomain.com_error_log
CustomLog /var/log/virtualmin/vserver.mydomain.com_access_log combined
ScriptAlias /cgi-bin/ /home/vserver/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/vserver/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/vserver/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/vserver/fcgi-bin/php5.fcgi .php5
<Directory /home/vserver/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.vserver.mydomain.com
RewriteRule ^(.*) https://vserver.mydomain.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.vserver.mydomain.com
RewriteRule ^(.*) https://vserver.mydomain.com:10000/ [R]
php_value memory_limit 32M
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824

If i only put RewriteEngine on with anything else i get the error "Illegal option RewriteEngine" in the apache error log

Only to make e try i changed the public_html directive with:

<Directory /home/vserver/public_html>
allow from all

but I always get the same error

Can you help me? Nicola

Anyone can help me? I also looked at the backed up configuration I had in my previous installation. The only difference I can see is the AllowOverride All without options in the previous configuration. As i told, i tryed it with no luck!

Please help me!

The great friend of mine Andrea, solved also this!! It was a problem of invisible characters in the .htaccess file (^M, the DOS/Windows line-ending characters) at the end of paragraphs. Removed them with editor in ssh i'm now able to modify it with my usual editor!