Different hosting locations have different settings for mod_rewrrite module. In some locations it is turned ON by default and for some it isn’t.
If you are hosting your application in your local host or on a dedicated server, then it is a matter of editing httpd.conf file within Apache server folder. Ensure that
LoadModule rewrite_module modules/mod_rewrite.so
is NOT commented inside httpd.conf file. In apache, # (pound sign) is used to comment text. So you need to remove the # sign if it appears before the above statement. Then again check if the following line is also not commented.
AddModule mod_rewrite.c
Once that is done, save the file and restart apache server for the changes to take place.
If you were hosting your applications in a web server where you don’t have access to its internal settings, you can test if mod_rewrite is turned on/off by the following ways:
Test 1:
Easiest way to test if mod_rewrite is ON/OFF is to create a php info file
Under “apache2handler” check for “Loaded Modules” section. There will be a list of loaded modules. Check if mod_rewrite is present in the list.
Test 2:
By creating a file called .htaccess and then by typing the following lines in it
Options +FollowSymLinks
RewriteEngine On
Save the file. If you had created a virtual site “abc”, you need to save .htaccess file inside /abc folder. Then access the site by entering http://domain.com/abc. If mod_rewrite is ON, then you will not get any error in the display else, you will be getting “Server Error – 500”