We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Redirect www to naked domain

Seth Giammanco November 17, 2019 by Seth Giammanco

Tried to use the .htaccess options provided in default install to redirect www to the naked domain.

# Option 1: rewrite www.example.com → example.com

<IfModule mod_rewrite.c>
    RewriteEngine On
    # (1)
    # RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]

I get there are too many redirects and it seems to be using the root path on the server in the URL that is created.

Any ideas?

Answered by Seth Giammanco!
>>>>>>> Answered <<<<<<<
3 Replies
1 Follower