Mod rewrite

From Wiki
Revision as of 22:13, 18 January 2017 by Seanc (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

General Information

Mod_Rewrite is available on our Linux/cPanel servers and can be used to rewrite or redirect your site to a particular URL.

  • The Apache Module "Mod_Rewrite" is also enabled on our LiteSpeed servers, and is very similar to "ISAPI_Rewrite", which is the (Windows) IIS Module alternative.
  • For more information on Mod_Rewrite please see our URL Rewrite Wiki.
  • For more information on ISAPI_Rewrite please see our ISAPI Rewrite Wiki.
IMPORTANT: Place the rewrite rules in a file named .htaccess and place it in the website's Default Directory(i.e. the \wwwroot folder).
  • If you do not have an .htaccess file already created you can:
    1. Open a text editor--like Notepad--and save the file as ".htaccess".
    2. Use the File Manager in the hosting control panel to create a .htaccess file on the server.

Redirecting to a Subfolder

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


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}