[adsense id=”0514458240″ width=”468″ height=”60″]
After setting up my OpenSuse 13 server I discovered that the mod_rewrite though it is installed is not available by default. The following steps are needed in order to have this setup:
- Edit the file /etc/sysconfig/apache2
- Find the line containing ‘APACHE_MODULES=”actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir php5 reqtimeout authn_core authz_core”‘
- Append rewrite to the set of APACHE_MODULES ‘APACHE_MODULES=”actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir php5 reqtimeout authn_core authz_core rewrite”‘
- Save the file
- Restart apache2 “rcapache2 restart”
At this point mod_rewrite module should now be working. To verify this create a file (phpinfo.php) in the root directory of your web server with the following contents:
<?php phpinfo();
Using the browser access the file using the address “http://ip_address_of_server/phpinfo.php”. Search the document for mod_rewrite. You will find this in the list of available modules.
Remove the file phpinfo.php – keeping this will give hackers information about your system so it is always best to remove it.
If you attempt to create an .htaccess file at this point you will still have problems with getting this to work. We need to make one final configuration change.
- Edit the file /etc/apache2/default-server.conf
- Find the line inside the ‘
containing “AllowOverride None”. - Change this line to “AllowOverride All”
Now mod_rewrite should be working with .htaccess on OpenSuse 13.2