amir abbas wrote:hello
my domain is on new server
both
http://persia-cms.com
and
http://www.persia-cms.com
works for my domain
how can i lock www in my first domain and all subdomain
i have subdomain in this address
http://forum.persia-cms.com
Very simple, if as I think the forum sub-domain is located in a separate folder (can be inside though) than the main domain's root.
If so, you'll just need to use the suggested rewriterules, the negative one :
- Code: Select all
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]
to you main domain's .htaccess.
This will make sure http://www.persia-cms.com is the only used domain for the main one.
Then, for your sub-domain's .htaccess, same thing as www.forum.persia-cms.com and forum.persia-cms.com are working, you have top choose one of the two and lock it.
Something like :
- Code: Select all
RewriteCond %{HTTP_HOST} !^www\.forum\.example\.com$ [NC]
RewriteRule ^(.*) http://www.forum.example.com/$1 [QSA,L,R=301]
to keep www prefix or :
- Code: Select all
[code]RewriteCond %{HTTP_HOST} !^forum\.example\.com$ [NC]
RewriteRule ^(.*) http://forum.example.com/$1 [QSA,L,R=301][/code]
To get rid of it.
++

English |
French



