If you are in need of redirecting all HTTP traffic to HTTPS traffic for a VirtualHost based Apache install, this simple line will do the job:

<VirtualHost     >
 ServerName             sybaspot.com
 ServerAdmin            webmaster@sybaspot.com
 CustomLog              logs/sybaspot-access_log combined
 ErrorLog               logs/sybaspot-error_log
 DefaultType            application/octet
 Redirect permanent     /                        https://ha-lb4-sb1/

Also, if you are looking to remove a subdomain from a URL (say you moved the document root or changed to a new server, or maybe want to remove WordPress or Joomla subfolder from showing in the URL:

RewriteEngine          On
RewriteRule            wordpress\/(.*)              /$1 [L,R=301]

What does this mean?  The (.*) says to grab all the extra URL parameters (subfolders, GET requests etc) and insert them into variable $1

Tagged with →  
Share →

Leave a Reply

Your email address will not be published. Required fields are marked *