KNnolwedge Blog
  • Home
  • Email Client Steps & Tips
  • WordPress Issues
    • Mail () Disabled
    • Setting up Specific Posts as Page
    • MySQL Concurrent Connection
  • VPS Plans & Upgrades
    • VPS General Issues
  • Redirect Codes
  • Zend Optimizer
  • Other .htaccess Rules
  • Home
  • Email Client Steps & Tips
  • WordPress Issues
    • Mail () Disabled
    • Setting up Specific Posts as Page
    • MySQL Concurrent Connection
  • VPS Plans & Upgrades
    • VPS General Issues
  • Redirect Codes
  • Zend Optimizer
  • Other .htaccess Rules
HTTP to HTTPS:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


HTTPS non www to HTTPS://WWW
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


HTTPS non www to HTTPS://WWW over port 80 (Recommended if website developed using an web app)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mindofadarkhorse.com/$1 [R,L]
</IfModule>


HTPS www to HTTPS non WWW -  (Recommended For Weebly Sites/Form not working with WWW)
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]


Standard 301 Redirect:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]