Enable mod_rewrite in Apache

April 13, 2013
linux apache web-server

I have been posting legacy.hacklog.in blog articles on Facebook for some time. The URLs do not look nice when the address finish with something like ?p=858. A web link such as https://legacy.hacklog.in/enable-mod_rewrite-in-apache is more readable than https://legacy.hacklog.in/?p=858. To get a human readable link you need to change the permalinks settings in WordPress. Just go to Settings > Permalinks and select the format you want to use. Apart from the default all other formats require mod_rewite to be enabled. The latter isn’t enabled by default in openSUSE.

To enable mod_rewite you need to edit the Apache config file.

vi /etc/sysconfig/apache2

Search for the line containing APACHE_MODULES.

APACHE_MODULES=”actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user autoindex cgi dir env expires include log_config mime rewrite negotiation setenvif ssl userdir php5 reqtimeout deflate authnz_ldap ldap wsgi”

Add rewrite to the APACHE_MODULES list and restart apache.

systemctl restart apache

Make sure you have the directive AllowOverride All set in your apache/vhost conf. WordPress already has RewriteEngine enabled in your site’s .htaccess file. Here’s a sample setting :

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

City Council of Barcelona switches from Microsoft Windows to Linux

February 11, 2018
linux ubuntu microsoft open source data protection

linux.com website compromised?

December 7, 2017
linux wordpress security

Linux Magazine's special edition on openSUSE

November 20, 2017
opensuse linux university-of-mauritius education