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)

๐Ÿค” Did you know?

ย 
๐ŸŒš You can turn on dark mode in Settings