How to Redirect non-www to www in .htaccess?
Redirecting non-www to www with .htaccess. How?
How to force www or non-www in htaccess?
How to redirect non-www URLs to www?
non www to www htaccess wordpress
htaccess non www to www 301
htaccess www to non www https
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
The contrary is also possible (www to non-www):
# Redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Another Way to Redirect
I think it may just be that your existing rule is too strict, and is not getting triggered in your sub-directory because of this. Something like this should work site-wide:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*) http://www.example.com/$1 [R=301]
No comments:
Post a Comment