DEV Community

Rácz Tibor Zoltán
Rácz Tibor Zoltán

Posted on

Apache redirect to non www and https with dynamic domain and request uri

Rewrite module is necessary!

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Enter fullscreen mode Exit fullscreen mode

Source

Top comments (0)