[CentOS] apache redirect rule

Thu Jul 23 15:28:23 UTC 2009
Filipe Brandenburger <filbranden at gmail.com>

Hi,

On Thu, Jul 23, 2009 at 10:46, David Hláčik<david at hlacik.eu> wrote:
> RewriteCond %{HTTP_HOST} extensions.polarion.com
> RewriteRule / http://extensions.polarion.com/polarion/extensions/

Usually those would be regexps, so the right syntax for what you want
would be something like:

RewriteCond %{HTTP_HOST} =extensions.polarion.com
RewriteRule ^/$ http://extensions.polarion.com/polarion/extensions/

The "=" in RewriteCond forces it to treat the second parameter as a
string (if that does not work for you, try ^extensions\.polarion\.com$
instead.)

In the second rule, you want to redirect only requests to /, so you
need to anchor it with ^/$.

And don't forget that you will also need:
RewriteEngine on

Other than that, it should work fine. But I suggest you test these
rules in a test environment first before commiting them to your
production machine.

HTH,
Filipe