How can I enable mod_rewrite on my cPanel server?

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 be used to redirect one URL to another URL, or to 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 URL 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 in .htaccess. The path generated by a rewrite rule can include a query string, or can 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:

  1. Log into your server as root via SSH terminal.
    • ssh root@serveripaddress -p 2200
  2. Query apache for currently installed modules, and search for 'rewrite'.
    • httpd -l |grep rewrite
      • root@kbtuts [~]# httpd -l |grep rewrite
        mod_rewrite.c
      • If you see 'mod_rewrite.c' returned, you've now confirmed it's installed and enabled properly on your server.
    • Video Coming Soon

If mod_rewrite is not enabled, please open a ticket with the Support Department.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

I'm unsure what to put as IP for the resolver configuration in WHM

Please leave default IPs in resolver configuration to give your VPS the best DNS performance...

Is there a way to limit bandwidth for a sub domain or cPanel account for one of our domains?

CPanel allows you to set the bandwidth limit for each account, once you reach the bandwidth...

Powered by WHMCompleteSolution