Hello guys,
sorry for this OT, but It seems that I am a very stupid :(. I want to achieve one simple think in apache 2.2.
If users will type extensions.polarion.com I want to redirect him to extensions.polarion.com/polarion/extensions However there are following rules that apply
1) extensions.polarion.com is an virtual host alias to community.polarion.com . There is a definition inside virtual host which redirects all / to /polarion using this RedirectMatch permanent ^/$ /polarion/
2) what I want to achieve is to check if user comes from extensions.polarion.com and If so to redirect him to extensions.polarion.com/polarion/extensions
I guess something like :
RewriteCond %{HTTP_HOST} extensions.polarion.com RewriteRule / http://extensions.polarion.com/polarion/extensions/
Is this going to work?
Thanks milion times.
David
Hi,
On Thu, Jul 23, 2009 at 10:46, David Hláčikdavid@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
Thank you Filipe,
It works, have a nice day.
David
On Thu, Jul 23, 2009 at 5:28 PM, Filipe Brandenburger filbranden@gmail.comwrote:
Hi,
On Thu, Jul 23, 2009 at 10:46, David Hláčikdavid@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 _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
put your check for extensions.polarion.com before the rule for community.polarion.com and end it with a [L] on the rewriterule.
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of David Hlácik Sent: Thursday, July 23, 2009 7:47 AM To: CentOS mailing list Subject: [CentOS] apache redirect rule
Hello guys,
sorry for this OT, but It seems that I am a very stupid :(. I want to achieve one simple think in apache 2.2.
If users will type extensions.polarion.com I want to redirect him to extensions.polarion.com/polarion/extensions However there are following rules that apply
1) extensions.polarion.com is an virtual host alias to community.polarion.com . There is a definition inside virtual host which redirects all / to /polarion using this RedirectMatch permanent ^/$ /polarion/
2) what I want to achieve is to check if user comes from extensions.polarion.com and If so to redirect him to extensions.polarion.com/polarion/extensions
I guess something like :
RewriteCond %{HTTP_HOST} extensions.polarion.com RewriteRule / http://extensions.polarion.com/polarion/extensions/
Is this going to work?
Thanks milion times.
David _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Hi Jacob,
thank you very much for your improvement! I did so.
Best Regards, David Hlacik
On Thu, Jul 23, 2009 at 5:46 PM, jacob@aers.ca wrote:
put your check for extensions.polarion.com before the rule for community.polarion.com and end it with a [L] on the rewriterule.
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of David Hlácik Sent: Thursday, July 23, 2009 7:47 AM To: CentOS mailing list Subject: [CentOS] apache redirect rule
Hello guys,
sorry for this OT, but It seems that I am a very stupid :(. I want to achieve one simple think in apache 2.2.
If users will type extensions.polarion.com I want to redirect him to extensions.polarion.com/polarion/extensions However there are following rules that apply
- extensions.polarion.com is an virtual host alias to
community.polarion.com . There is a definition inside virtual host which redirects all / to /polarion using this RedirectMatch permanent ^/$ /polarion/
- what I want to achieve is to check if user comes from
extensions.polarion.com and If so to redirect him to extensions.polarion.com/polarion/extensions
I guess something like :
RewriteCond %{HTTP_HOST} extensions.polarion.com RewriteRule / http://extensions.polarion.com/polarion/extensions/
Is this going to work?
Thanks milion times.
David _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos