I’m attempting to redirect all http://www.subdomain.example.com traffic to subdomain.example.com. Currently, if someone uses the www, they receive an error that the server isn’t found. I attempted to add the following to the .htaccess file:
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
However, the error still occurs. Is there a way to resolve this issue?
You cannot solve this with rewriting. The server is not reachable via “www.” which technically is a subdomain.