mod_rewrite not working

Viewed 41377

I'm new to server administration but I was able to get a LAMP setup running on my new VPS. I uploaded a few web files that work on my other server, but they seem to give me the error: "File does not exist" in my /var/log/apache2/error.log file. The homepage loads just fine through my scripting, but other pages don't.

.htaccess file code

    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?r=$1 [L,QSA]

I have enabled mod_rewrite on the server and can see it running under my phpinfo() page I have created. Simply don't know why this issue is happening. If I need to post anything else, please let me know :)

3 Answers

ERROR: Module rewrite does not exist February 21, 2014 by Sharad Chhetri Leave a Comment

While working on Apache Module in Ubuntu,I found rewrite problem in Apache Web Server.I tried to enable the rewrite module but got this error ERROR: Module rewrite does not exist!.After troubleshooting,I found the problem was with mod_rewrite module.

After doing some more troubleshooting,it is found that the rewrite.load file was missing in /etc/apache2/mods-available/ .

Now,I checked the mod_rewrite.so actual module file and Wow it was there.

Below given is step by step command which I ran,to solve this issue.Here is the reference from my system

root@tuxworld:~# a2enmod rewrite

ERROR: Module rewrite does not exist!

root@tuxworld:~# ls -l /usr/lib/apache2/modules/mod_rewrite.so

-rw-r--r-- 1 root root 58728 May 28 2020 /usr/lib/apache2/modules/mod_rewrite.so

root@tuxworld:~#

root@tuxworld:~# echo "LoadModule rewrite_module

/usr/lib/apache2/modules/mod_rewrite.so" > /etc/apache2/mods-available/rewrite.load

root@tuxworld:~#

root@tuxworld:~# a2enmod rewriteEnabling module rewrite.

To activate the new configuration, you need to run:

service apache2 restart

root@tuxworld:~#

After this I restarted the apache2 service

sudo service apache2 restart

Related