How to check if mod_rewrite is enabled on the live server via .htaccess file? If not, how I can enable it?

How to check if mod_rewrite is enabled on the live server via .htaccess file? If not, how I can enable it?

September 23, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to check if mod_rewrite is enabled on the live server via .htaccess file? If not, how I can enable it?

Checking if mod_rewrite is Enabled on Your Server

If you’re working with Magento or any other PHP application that relies heavily on .htaccess files for URL rewriting, it’s crucial to ensure that the Apache module mod_rewrite is enabled on your server. This module allows powerful URL manipulation and redirects that are essential for clean, SEO-friendly URLs.

Understanding mod_rewrite

The mod_rewrite.c module in Apache is responsible for processing rewrite rules defined in the .htaccess file or <VirtualHost> configuration files. It uses regular expressions to match incoming requests against defined patterns and rewrites them accordingly. Enabling this module is a first step towards implementing dynamic URL routing.

How to Check if mod_rewrite is Enabled

1. Server Configuration Files

The most reliable way to check if mod_rewrite is enabled is by examining your server’s configuration files, typically located in the /etc/apache2/ or /etc/httpd/ directory (depending on your Linux distribution). Look for a file named apache2.conf or httpd.conf.

Open this file using a text editor:

sudo nano /etc/apache2/apache2.conf

Or, if you’re using httpd:

sudo nano /etc/httpd/conf/httpd.conf

Search within the file for a line that looks like this:

LoadModule rewrite_module modules/mod_rewrite.so

If this line is present and not commented out (i.e., doesn’t start with #), then mod_rewrite is enabled.

2. Server Info Page

Another quick way to check is by looking at the server info page, which displays various configuration details about your Apache installation. You can access this page by visiting:

http://yourdomain.com/server-info

Replace yourdomain.com with your actual domain name or IP address.

Scroll down until you find a section titled “Loaded Modules”. If mod_rewrite appears in the list, it means that the module is already enabled on your server.

Enabling mod_rewrite if It’s Not Already Active

If mod_rewrite is missing from your configuration files or not listed in the Server Info page, you’ll need to enable it manually. Here are the steps:

  1. Open the main Apache configuration file (either apache2.conf or httpd.conf) using a text editor.

  2. Add the following line somewhere near the top of the file, ensuring there’s no leading #:

LoadModule rewrite_module modules/mod_rewrite.so

This line corresponds to the location where the mod_rewrite.so module is stored on your system.

  1. Save and close the file.

  2. Restart the Apache server for the changes to take effect:

sudo service apache2 restart

Or, if you’re using httpd:

sudo systemctl restart httpd

Conclusion

Enabling mod_rewrite is a critical step in setting up your development or production environment for applications like Magento. It allows you to implement complex URL rewriting rules that can significantly improve the user experience and SEO performance of your website.

Remember, always backup your configuration files before making changes. If you’re unsure about any part of this process, consult with a professional developer or your hosting provider’s technical support team.

Happy coding!

Extensions Configuration SEO

Our network