Skip to main content

Posts

Showing posts with the label htacces

Remove www & force https from URL using htaccess

By Using below code we are able to remove www and force https from URL using htacces   RewriteEngine On   RewriteCond %{HTTP_HOST} ^www.greenrobot.com$ [NC] RewriteRule ^(.*)$ https://greenrobot.com/$1 [R=301,L]   RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]   Or   <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule>