mod_rewrite enable is not function?


I tried to install web apps on my server, there was impression from the developer that my apache rewrite module is not function, while I can verify that the module (rewrite) is enable in the webmin.
the pat supposed to
Actually, all request made to apps, are request made to the “index.php”
file. the web_apps trusts the apache rewriting system to transform any
“/<apps_path>” to “/index.php/<apps_path>”.

Any help really appreciated…

Actually, all request made to apps, are request made to the “index.php”
file. web apps trusts the apache rewriting system to transform any
“/<apps_path>” to “/index.php/<apps_path>”.

The mod_rewrite module should be available in Apache by default – and that’s something your developer should be able to make use of from a .htaccess file.

Are they getting an error of some kind? If so, what error are they getting?


If I manually force to use url
I managed to get the login screen, after submitting the proper login screen and password
It went to
and it gave me this error…
The requested URL /login was not found on this server.

According to the developer it should
as they mentioned that all request made to webapps, are request made to the "index.php

I tried to set the the AllowOveyride to All
DocumentRoot /var/www

Options FollowSymLinks
AllowOverride All

And create my own .htaccess to rewrite the url…

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|.php|.html|.htm|.feed|.pdf|.raw|/[^.])$ [NC]
RewriteRule (.
) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

Some other weird sitiuation, instead rewrite the url to index.php, apparently it trying to rewrite the url to
Which is what I want is

any suggestion are welcome… Thanks



Well, there’s nothing in that which tells it to redirect to the URL you’re seeing – that may mean it’s the application itself doing that, not mod_rewrite.

Also, note that for mod_rewrite to work, each VirtualHost block in the Apache config that needs to use mod_rewrite needs to have “Allowoverride None” set.

And if you’re seeing 500 errors – you can look in $HOME/logs/error_log to see what the problem is, the details of the error you saw should be listed in there.


on the error log mostly I see…

[Mon Oct 17 08:04:09 2011] [error] [client] Premature end of script headers: php5.cgi, referer: Then when I tried to force access link

I got the login screen but after I submit my user name and password it’s redirect me to…

And below the logs from apache

[Mon Oct 17 08:07:19 2011] [error] [client] Premature end of script headers: php5.cgi, referer:

Hi Eric,

Can you please give me advice, if there something that I need to changes on this line… this one was automatically generated by Virtualmin. Thanks a lot…

SuexecUserGroup "#1006" "#1007" ServerName ServerAlias ServerAlias ServerAlias DocumentRoot /home/ ErrorLog /var/log/virtualmin/myapps.domain.com_error_log CustomLog /var/log/virtualmin/myapps.domain.com_access_log combined ScriptAlias /cgi-bin/ /home/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 Options -Indexes +IncludesNOEXEC +FollowSymLinks allow from all AllowOverride All Action application/x-httpd-php5 /cgi-bin/php5.cgi AddType application/x-httpd-php5 .php5 AddType application/x-httpd-php5 .php allow from all RewriteEngine on RewriteCond %{HTTP_HOST} RewriteRule ^(.*) [R] RewriteCond %{HTTP_HOST} RewriteRule ^(.*) [R] RemoveHandler .php RemoveHandler .php5

Well, as I mentioned – I think the issue is with your application, rather than with mod_rewrite (or your Apache config).

Your application is likely using PHP’s $_SERVER[‘SCRIPT_NAME’] variable to determine the URL to use, and that won’t work correctly when using the CGI or FCGID PHP execution modes, it needs to determine that information a different way.

If it’s an application you’re building, the best way to fix it is to change the code to not use $_SERVER[‘SCRIPT_NAME’] to generate your URL’s.

If it’s a pre-existing application – some applications can be corrected by editing your $HOME/etc/php.ini file, and setting “cgi.fix_pathinfo” to “0”.

Another way to resolve it may be to go into Server Configuration -> Website Options, and change the PHP Execution Mode to mod_php.


Here’s some other configuration .htaccess, in case you missed it…

GNU nano 2.2.6 File: .htaccess

<FilesMatch “pre_.+.php”>
Order deny,allow
Deny from all

RewriteEngine On

uncomment the following line, if you are having trouble

getting no_script_name to work

#RewriteBase /

we skip all files with .something

RewriteCond %{REQUEST_URI} …+$
RewriteCond %{REQUEST_URI} !.html$
RewriteRule .* - [L]


on you remarks…
“Another way to resolve it may be to go into Server Configuration -> Website Options, and change the PHP Execution Mode to mod_php.”

I dont think that I have that option on my screen…
Please see attached…


Just find the solution… just need change mode to mod_php.
by doing this …

apt-get install libapache2-mod-php5 --reinstall

Following this thread …

So far so good thanks…

That’s great that you got it working!

Normally, mod_php is configured by default… it’s possible that it was disabled along the way though.


Hi Eric,

I would love to have the FCGId as another option, how can I achieve that? If you look on my attachment i dont have the FCGId option either.



How did you install Virtualmin? Did you use the script to perform the installation?


Yes, I did, but base on the last experience, it might be disable along the way…

Yeah, Virtualmin’s would enable FCGID by default.

So, how to re-enable that depends on how it was disabled, as well as what distribution you’re using.


Thanks for your response, how can I determine if it was disable or not? I’m expecting to have a way just to re-install command maybe?

How to do all that depends on your distribution… what distribution are you using?

Distributor ID: Ubuntu Description: Ubuntu 11.10 Release: 11.10 Codename: oneiric