.htaccess: Redirects, Rewrite Rules and Site Protection

Hosting & cPanel · 15.07.2025
.htaccess: Redirects, Rewrite Rules and Site Protection

HTTPS Redirect

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Remove www

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
← Back to Knowledge Base Ask Support