Hello.
I'm using htaccess to redirect to www.mysite.com when it's written mysite.com.
But I need not to have www when it's in subdirectory. For example if I'm in www.blog.mysite.com, it should redirect to blog.mysite.com.
How I can do that?
| SitePoint Sponsor |
Hello.
I'm using htaccess to redirect to www.mysite.com when it's written mysite.com.
But I need not to have www when it's in subdirectory. For example if I'm in www.blog.mysite.com, it should redirect to blog.mysite.com.
How I can do that?


Do you expect anyone would ever type www.blog.mysite.com anyway? "www" is a subdomain like "blog", so it's unlikely that anyone would type them both.
Anyhow, I have a subdomain on my site, and if I type "www." before it the browser just goes to the subdomain anyway. Perhaps that's because I redirect "www" to the non-www version for the domain name anyway.
Just to clarify, do you prefer your site to show "www" in the address or not?
I need to have it two types.
if no subdomain, I need to have www.mysite.com,
but with subdomain no www, just blog.mysite.com

edgar,
Have you looked at the sample code section of my signature's tutorial? Have you looked at the sticky threads for this board? It's all there (except your domain name)!
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Bookmarks