Sunday, June 21, 2009

Apache mod_rewrite and per-host directives / subdomains

This feature of Apache is very powerful and useful. Well, for those who really understand it :) For the rest of us, it is hours of trials-and-fails until we reach wanted configuration.

So, let's say we have a domain (domain.com). We have setup a WildCard DNS records to point to our web server (*.domain.com) and we also have setup our VirtualHost with this wildcards:

ServerName domain.com
ServerAlias *.domain.com

Now, we want to make a translation of
http://sub.domain.com/ to http://www.domain.com/subdomains/sub/

Most of the articles and tutorials I found over the internet are just redirecting requests. So the end-users never actually stay on sub.domain.com, but are transferred to www.domain.com/subdomains/sub . This I don't want. Here is a brief set of rules how to achieve that: http://www.debian-administration.org/article/Wildcard_hosting_with_Apache_and_Bind
They are jsut redirecting.

However I want the end-users to stay on http://sub.domain.com/ however all internal requests to go to http://www.domain.com/subdomains/sub . And also I want it that way only that particular "sub".

And here is the simple solution:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(sub)\.domain\.com
RewriteRule ^(.*) http://www.domain.com/subdomains/sub/$1 [L,P]

The keypoint here is that is we skip the P flag, mod_rewrite will make automatic external redirect. It is not smart enough to guess that this is our server. That's why we have to put the P-flag, which claims that we want this redirection to take place via "internal Proxy"

Well, that's for now. Hope to post some new stuff soon

Thursday, November 6, 2008

Flash player under Windows Server 2008

OK,
I decided to move to the Server OS because of many reasons. I hope that I will not regret soon.
What's going on ?
Have you ever heart of Adobe Acrobat Connect (AAC) ? It is an Adobe online software designed to bring presentations and desktops to the web (a descendant of Breeze). It is Flash based (Flex may be, at least you need a flash player on the browser to participate).
So, I had to participate an online presentation hosted on AAC, and I was surprised to see the following window:You can hardly see, but in short: It says: "Adobe Acrobat Connect requires Flash Player 8.0.0.0 or newer".
The funny thing is that all that message is displayed inside a flash player, and I made this screen-shot to show you that I actually have Adobe Flash Player 10 installed.
But wait it becomes funnier. When I clicked the "GetFlash Player" button (Also a flash button!) I went to a page that showed out the next interesting screen:
Which says: Sorry, your platform is not supported.

Funny, ah ?
But I could not participated that connect meeting.

Hyper-V lives in US! (Part 2)

Earlier today I described a problem that is known to MS and has no solution yet.
In short - you can install (mean really install a working version) Hyper-V under Windows Server 2008, only if you set all locale settings to EN-US / USA Location. Every other attempt will lead to a broken installation.
I also promised that after this installation I will revert back to desired location settings to check if everything is going on well.
And the answer is ....
YES!
After installing the Hyper-V Role under EN-US Locale / USA Location forced to all system accounts also, you can safely revert back to the desired locale settings and the Hyper-V will continue working.

Tough one!

New user group in Bulgaria!

Hey!
Did you know? A brand new baby is being born here in Bulgaria. It's name is Sharepoint Usergroup Bulgaria.
I already registered there. And if you are interested in developing for/with Sharepoint, and also happen to be in the neighborhood, go for it!
The first presenter will the Sahil Malik, a MOSS MVP and INETA speaker.

Thanks to Martin Kulov who is giving so much to the local community!

Live writer on Server OS ? Help !

Have you ever tried the Windows Live Writer ?
It is really nice and handy application that helps you with posts. I used to make my posts with it. But after the upgrade to Windows Server 2008 guess what ?

---------------------------
Windows Live Installer
---------------------------
Sorry, Windows Live programs cannot be installed on Windows Server, Windows XP Professional x64 Edition, or Windows operating systems earlier than Windows XP Service Pack 2.
---------------------------
OK
---------------------------

Why ???
So, please, if anybody has a solution to this behavior, please help!

P.S. No, I don not think that it is a solution to use a virtual machine with Windows XP just to use Live Writer. No way!

HEELP ! :)