.htaccess Rewrite Rules for no-www Domain Redirecting
If you just want the .htaccess generator tool, click here to scroll down
Not sick of typing or seeing the nonsense www. in front of each websites you visit? Does it have a meaning? Had it?
It had! But not since the browsers got smart.
www is used to define that “web pages” being asked and served. Web pages are transferred in http which is a protocol used in web-browsers. That means, if you add http:// in front of your request; then you mean “Hey I’m asking for sort of a web page”.
The browsers we use for years are got smart enough to add http:// in front of every address we type, by default. Since they are web-browser, they should.
–I got it when you said “http://” I’m not stupid. No need to tell me again in different words.
Now; As almost every smart guy can get the nonsense of using www today, can go a step further. More logical domain names.
When I request http:// mail.google.com.tr means that I look for a web page which is from turkey (.tr), which is a commercial site (.com.tr), which is part of google (google.com.tr) and which is called mail. I think this should be enough to explain the hierarchical structures of domain names. They are same in the way our home addresses have. blah blah avenue, New York, USA (And for the future compliance I’d like to add Earth
)
My webblog’s main page is my front page; served in http://gri.in where you will be redirected to, if you are stubborn to ask for www.gri.in
I have http://ip.gri.in where I run a simple tool to give you your IP address. That page is a part of my web-site not directly connected to my blog while its a sub-site under gri.in web-site.
I also have http://m.gri.in where mobile version of my blog is served to mobile users. etc…
Anyway. I love talking but its enough for now.
Having both www and non-www links work makes your site lover in the search ranks while giving an impression to be different sites and poor webmaster work.
The tool below will generate htaccess files for webmasters, which you can use to make your web-sites smart. .htaccess files are used in Apache web servers (usually used in *nix systems (Linux, BSD etc.). As you type your domain name the first box will generate a text to redirect all www. requests to root domain, As it’s in my web-server, while the next box will make the opposite. The choice is yours. Most of web-sites are using one or the other. But every day, first way is being chosen by more, which is the logical one.
The rules generated here won’t work for https requests where things might get ugly if you have a ssl certificate.
Domain:
www.
www.example.com => example.com |
example.com => www.example.com |


