Contact
Site: US UK AU |

.htaccess rewrite commands

Example code for common .htaccess rewrite commands

Force SSL for the entire site or directory

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

Rewrite base directory into a sub-directory

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC] 
RewriteRule ^$ http://%{HTTP_HOST}/subfolder/index.php [R,L]

Route requests through PHP-based dispatcher

RewriteEngine On 
RewriteBase /
RewriteCond %{REQUEST_URI} !^/dispatcher.php
RewriteRule (.*) /dispatcher.php%{REQUEST_URI} [L]

 For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How to manage index files
Added on Mon, Aug 5, 2013
How to enable and disable .htaccess files with SiteWorx
Added on Mon, Aug 5, 2013
How to prevent bandwidth theft or Hotlinking
Added on Mon, Aug 5, 2013
How to create and manage Apache handlers
Added on Tue, Aug 6, 2013
How to create .htaccess files
Added on Fri, Aug 2, 2013
How to allow or block hostnames and IP addresses
Added on Wed, Jul 31, 2013
How to block IPs with .htaccess
Added on Tue, Aug 6, 2013
How to create and manage MIME types
Added on Tue, Aug 6, 2013
Creating and managing custom error pages
Added on Tue, Jul 30, 2013
How to create URL redirect rules
Added on Tue, Jul 30, 2013