«

»

May 22 2012

Print this Post

Removing www from your URL

I finally decided to shut down my home based server for HTTP use for good. Why? With all the school work, I don’t have time to fix issues with the system. It comes with an added benefit of having a site that will be up 99.99%(according to the hosting provider’s uptime guarantee.) unless I make a coding error.

Anyway, while I was transferring data from self hosted server to the new hosting provider, I ran into few issues. One would be the transfer of data from the wordpress self host system to the paid professional service. I am still working on database issues such as my massive collection of multiple choice questions database for University of Calgary courses.

While I ran in so many issues, I also found solutions for some of my problems. One would be to auto removal of www from the site URL by editing .htaccess. Finally run in to so many Error 500s, this is the code that worked for this site. You can also just copy this to your .htaccess file and switch the “sanuja.com” with your domain data.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.sanuja.com$ [NC]
RewriteRule ^(.*)$ http://sanuja.com/$1 [R=301,L]

I will write a post on advantages and disadvantages of hosting my site on a web hosting provider. Until then, all the best and happy blogging.

Permanent link to this article: http://sanuja.com/blog/removing-www-from-your-url

1 ping

  1. Direct all traffic to a single page using Apache rewrites » Sanuja Senanayake

    […] engines and databases). I wrote about removing the “www” from a URL using 301 redirects here. Today we will expand a bit on rewrite engine (RewriteEngine) using real examples. RewriteEngine […]

Comments have been disabled.