mod_rewrite availability


that is my first post here and I hope you are gonna help me with my Proble, I have. So I tried to use the Apache modul mod_rewrite in some htaccess files. But unfortunately it won’t work properly. Also I use an LMS called ILIAS and the backend of this servics says, that the mod_rewrite is not activated.

So, I was going to check some setting in mine Apache Web Server and in the backend of Virtualmin and Webmin. So fare I got the result, that I really have mod_rewite installed and it is working,too. But just on a different configuration layer. For example if I use the rewrite engine in the webmin config Editor /etc/apache2/sites-available/my-domain.conf it is just working fine. But I also need the rewrite engine in the htaccess files and so fare it’s not working.

My question is, how is it possible to give the Virtual Web Server or directory the permissons to use the mod_rewrite probatly in full functionality ?

I would be so happy if I get some help

Please excuse my bad speeling I’m not a native Speaker :wink:


The mod_rewrite module normally is available by default to all domains.

Which distro is it that you’re using?

And what is the output of this command:

cat /etc/apache2/mods-enabled/rewrite*

Hi andreychek,

I’m using Ubuntu 12 LTS for my Virtual/Webmin Installation. I have read the same Information, that the mod_rewrite module should be available always, but it’s not in my Situation. And it is a complete new set up of virtualmin.

If I use your command, I get this Output:

LoadModule rewrite_module /usr/lib/apache2/modules/

I hope you have any further idea :slight_smile:

Additionally I found out, that the mod_rewrite is probably working but not in full functionality. For example I need the funktion RewriteCond and Options +FollowSymLinks in my htaccess file. Have just a look at the config:

RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^(.*)$$1 [R=301,L]

It just will not work properly.

Remember that per new security rules, you should not use “FollowSymLinks” in any .htaccess file.

Rather, replace it with the more secure “SymLinksifOwnerMatch”

(drop in replacement!!)

Here’s a script that will let you search for instances:

# find /home -name “.htaccess” -type f -exec grep -i ‘FollowSymLinks’ {} “;”

And a script that would CHANGE all the instances:

# find /home -name “.htaccess” -type f -exec sed -i ‘s/FollowSymLinks/SymLinksIfOwnerMatch/g’ {} “;”

(this is assuming your user files are in /home)


I don’t think there’s a way to have partial functionality of mod_rewrite… it should either be on, or off.

I suspect you may be seeing an issue with exact htaccess code being use.

An alternate way to do what you described, that doesn’t rely on the exact domain name existing in the htaccess file, would be to use the following:

RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Try using that and see if that resolves the problem you’re seeing.


Ah yes, and jimdunn is correct – since the Apache config explicitly disables the use of the “FollowSymlinks” option, using that would indeed cause a problem.

If that’s occurring, that would be throwing an error in $HOME/logs/error_log.