User Tools

Site Tools


control-panels:cpanel-whm:how-can-i-enable-mod_rewrite-on-my-cpanel-server

Confirming mod_rewrite is enabled

KnownHost's VPS's and Dedicated servers have mod_rewrite enabled by default! Lucky you! ;-)

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.
  2. Query apache for currently installed modules, and search for 'rewrite'.
    • httpd -l |grep rewrite
      • [email protected] [~]# 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.

control-panels/cpanel-whm/how-can-i-enable-mod_rewrite-on-my-cpanel-server.txt · Last modified: 2015/01/12 23:33 by Jonathan W.