Redirecting all URLs from olddomain.com to newdomain.com
So the example below is redirecting all URLs from olddomain.com to newdomain.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.olddomain\.com$
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^olddomain\.com$
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
You can also apply this to a subdomain – so the example below is redirecting all URLs from subdomain.olddomain.com to subdomain.newdomain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^subdomain.olddomain.com$
RewriteRule ^(.*)$ http://subdomain.newdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.subdomain.olddomain.com$
RewriteRule ^(.*)$ http://subdomain.newdomain.com/$1 [R=301,L]
Force a Directory Folder or WebSite to go over HTTPS SSL with htaccess
To force a website to use the secure protocol SSL running the whole site over HTTPS you can make a simple edit to the .htaccess file in the document root.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
To force a particular folder or directory to serve over SSL, create a .htaccess file in that folder and apply the following to it:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$ https://www.domain.com/somefolder/$1 [R,L]
This assumes SSL is enabled on the domain on an Apache Web Server with the mod_rewrite module enabled.
Redirecting WWW to non-WWW with htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Just make sure you add it at the very top of the htaccess file.
Refrensi :
Redirecting a Web Folder Directory to another Directory in htaccess


info yang sangat bermanfaat gan.