How to Enable mod_rewrite

The mod_rewrite refers to a module for Apache web server, which rewrites or redirects requests to a specific content. This module transforms incoming requests to a path in the web server’s system.

This line of code should always be placed on the first line of your rewrite code, so that it enables the mod_rewrite feature that rewriting requires.

Here’s a sample use of mod_rewrite, redirect all website pages:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$$1 [R=301,L]

This code will be added to your .htaccess file on your directory.

Please don’t hesitate to get in touch with our 24/7 Singapore or Australia Support Team, they’ll be happy to help.

(Visited 176 times, 1 visits today)

Was this article helpful?

Related Articles