How to check whether mod_rewrite is enable on server?

knightrider picture knightrider · Sep 7, 2011 · Viewed 279k times · Source

Currently I am using the hosting with lightspeed server. Hosting says mod_rewrite is enabled but I can't get my script working there. Whenever I try to access the URL, it returns 404 - not found page.

I put the same codes at another server which is running with Apache. It's working over there. So I guess, it's the .htaccess and mod_rewrite issue.

But Hosting support is still insisting with me that their mod_rewrite is on, so I would like to know how can I check whether it's actually enabled or not.

I tried to check with phpinfo(), but no luck, I can't find mod_rewrite there, is it because they are using lightspeed?

Is there any way to check? Please help me out. Thank you.

FYI: my .htaccess code is

Options -Indexes

<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>

I tried like this also

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

But same result.

Answer

KawaiKx picture KawaiKx · Jun 8, 2016

from the command line, type

sudo a2enmod rewrite

if the rewrite mode is already enabled, it will tell you so!