I have setup an .htccess file to redirect www to non-www and also remove trailing slashes. I also have to make sure that business.domain.com also redirects (301) to domain.com. The other rules work except redirecting business.domain.com.

<IfModule mod_rewrite.c>
RewriteEngine On
# redirect to non-www
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# redirect business subdomain to no subdomain
RewriteCond %{HTTP_HOST} ^business.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# redirect non-trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)$
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Any ideas why the 2nd cond/rule isn’t taking effect?

Read more here: .htaccess isn’t redirecting subdomain


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, ,

Wordpress related questions and answers: