amariotti.com

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

Recent blog posts

  • 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
  • 1 Year
  • Happy Birthday WWW!
more

Recent comments

  • Turning off PHP suhosin
    36 weeks 11 hours ago
  • The code for D5 is posted
    36 weeks 1 day ago
  • Repost the code please :)
    36 weeks 5 days ago
  • Hi, very nice post. I have
    38 weeks 1 day ago
  • Great post! I'll subscribe
    38 weeks 4 days ago
  • Cool! It works perfectly..
    39 weeks 6 days ago
  • I'm having the same problem.
    40 weeks 4 days ago
  • Hello again. It's working but
    40 weeks 4 days ago
  • I'm having the same issue, it
    40 weeks 5 days ago
  • Yes, when I open the page I
    40 weeks 5 days ago

Blog tags

drupal drupal 6 drupal issue liquidweb module modules that I love os x random rss Salesforce.com software theming
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
  • 1898 reads

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <b> <p> <br>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You may use <swf file="song.mp3"> to display Flash files inline

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
4 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
  • about
  • blog
  • portfolio
  • resumé
  • modules
  • contact