amariotti.com

  • about
  • blog
  • modules
  • portfolio
  • resumé
  • contact
Home › Blogs › amariotti's blog

Recent blog posts

  • Reverse NodeReference Block - Revisited
  • CS4 Keyboard Issues
  • Text Formatter Module
  • Cool Apache ReWrite Trick
  • New RSS Feed
  • Find My iPhone
  • Congratulations, Drupal!
  • Re-Launched on Drupal 6
  • Copying + Pasting from Word into Drupal
  • Page Not Found on Node Creation
more

Blog tags

cck drupal drupal 6 drupal issue liquidweb module modules that I love os x random review views xbox
more tags

Cool Apache ReWrite Trick

amariotti — Tue, 08/11/2009 - 08:27

A few months ago it came to my knowledge that a co-worker of mine had been managing some domain names for his department. Since starting here that's been one thing that I have noticed is that if someone wants something (i.e. website, domain name) they just go ahead and buy it! This situation was unique in that said co-worker was paying for the domain names from his own pocket! I didn't find that out until later, but I was glad that I asked.

One of my goals has been to try and collect all domain names for the College and have them managed from a central place. So I immediately told him that we could transfer the domain name to the Regsiter.com account so that it can be managed with the rest of the domains in his department. He concurred and we began the long process of transferring the domains.

The primary reason for our initial meeting was to start the planning phase to convert these three websites to Drupal from SharePoint. I'm not a huge fan of SharePoint sites, and frankly not a fan of the system as a whole so I didn't hesitate to start pointing out faults in it. Drupal is very easy to sell to someone that only has experience with such a broken Web CMS as SharePoint.

Once the domains were transferred to point to his departments primary website I got a phone call saying, "Why is it doing that? We need it to point to my SharePoint site until we have something functional!" So then I started digging to see what solution we could find. Strangely enough Register.com doesn't have a free way for you to redirect a domain name to another URL without paying $50 (minus 50 points for Regsiter.com). So I turned to Apache and my htaccess file for the trick. The trick was the it needed to point to a folder on his SharePoint server, which wasn't a problem at all. Here are the lines from my .htaccess file:

RewriteCond %{HTTP_HOST} ^yourdomain\.org$ [NC] RewriteRule ^(.*)$<br />
https://www.sharepointsite.com/folder$1 [L,R=301]

It was actually a lot easier than I thought it would be. I simply had to modify my other RewriteRules that remove the "www" and just put in the URL to the folder on the directory. Worked like a charm!

  • apache
  • drupal
  • htaccess
  • multi-site
  • amariotti's blog
  • 2414 reads
  • about
  • blog
  • modules
  • portfolio
  • resumé
  • contact