KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

Confirming mod_rewrite is enabled

Category: cPanel
Tags: # # # #

What is mod_rewrite?

The mod_rewrite module uses a rule-based rewriting engine based on a PCRE regular-expression parser to rewrite requested URLs on the fly; by default, mod_rewrite maps a URL to a filesystem path. However, it can also redirect one URL to another URL or invoke an internal proxy fetch.

mod_rewrite provides a flexible and powerful way to manipulate URLs using an unlimited number of rules. Each rule can have an unlimited number of attached rule conditions to allow you to rewrite URLs based on server variables, environment variables, HTTP headers, or time stamps.

mod_rewrite operates on the full URL path, including the path-info section. A rewrite rule can be invoked in httpd.conf or .htaccess. The path generated by a rewrite rule can include a query string or lead to internal sub-processing, external request redirection, or internal proxy throughput.

In summary, mod_rewrite needs to be enabled on your server to use .htaccess configurations, such as redirects.


Confirming mod_rewrite is enabled

Due to the overwhelming majority of websites requiring mod_rewrite, it’s enabled by default. To confirm it’s enabled you can perform the following:

Login to server as root and run the following command,

httpd -l |grep rewrite

If it is enabled, you should expect the output as same as below,

root@duplicate [~]# httpd -l|grep rewrite
mod_rewrite.c

Conclusion

Now that we’ve gone over it, how to confirm mod_rewrite is enabled on the server or not. mod_rewrite is widely used to perform redirection from the web server.

KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you with requests should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your webhosting experience.