Re: [users@httpd] mod rewrite
Igor, I am not sure what you mean. The ?domain=xxx.com option works great. I was just wondering if there was a way to change it from ?domain=xxx.com to /xxx-com/ simply changing the . to a - Is it possible? I didn't know if it was possible to put that into a regex replacement of a sort. Thanks Steffan On 11/26/12 12:53 AM, Igor Cicimov icici...@gmail.com wrote: On 26/11/2012 4:17 PM, Steffan A. Cline stef...@hldns.com wrote: Is there a way to rewrite the HTTP_HOST where the . Is changed to a - ? HTTP_HOST= something.com http://something.com Redirects to domain.com/something-com/ http://domain.com/something-com/ Is it possible? There is nothing to rewrite here. You need to do what you already said above, redirect the domain something to the other url. Thanks Steffan On 11/8/12 11:38 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.)?domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 3:36 PM, Steffan A. Cline stef...@hldns.com wrote: Works a charm with one exception. www.domain.com http://www.domain.com redirects to domain.com?domain=www.domain.com http://domain.com?domain=www.domain.com Anyway to fix that? www.domain.com http://www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.com wrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com http://domain.com So, abc.com http://abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
On the rewrite rule, I was working on RewriteRule ([\w]*)\.(.*) http://domain.com/$1-$2/ BUT what if there is anything before xxx.com like www.xxx.com? I am no pro with regex but trying to find a way around that. Thanks Steffan On 11/26/12 10:46 AM, Steffan A. Cline stef...@hldns.com wrote: Igor, I am not sure what you mean. The ?domain=xxx.com option works great. I was just wondering if there was a way to change it from ?domain=xxx.com to /xxx-com/ simply changing the . to a - Is it possible? I didn't know if it was possible to put that into a regex replacement of a sort. Thanks Steffan On 11/26/12 12:53 AM, Igor Cicimov icici...@gmail.com wrote: On 26/11/2012 4:17 PM, Steffan A. Cline stef...@hldns.com wrote: Is there a way to rewrite the HTTP_HOST where the . Is changed to a - ? HTTP_HOST= something.com http://something.com Redirects to domain.com/something-com/ http://domain.com/something-com/ Is it possible? There is nothing to rewrite here. You need to do what you already said above, redirect the domain something to the other url. Thanks Steffan On 11/8/12 11:38 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.)?domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 3:36 PM, Steffan A. Cline stef...@hldns.com wrote: Works a charm with one exception. www.domain.com http://www.domain.com redirects to domain.com?domain=www.domain.com http://domain.com?domain=www.domain.com Anyway to fix that? www.domain.com http://www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.com wrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com http://domain.com So, abc.com http://abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
Is there a way to rewrite the HTTP_HOST where the . Is changed to a - ? HTTP_HOST= something.com Redirects to domain.com/something-com/ Is it possible? Thanks Steffan On 11/8/12 11:38 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.)?domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} http://domain.com?domain=%%7BHTTP_HOST%7D [R,L] On Fri, Nov 9, 2012 at 3:36 PM, Steffan A. Cline stef...@hldns.com wrote: Works a charm with one exception. www.domain.com http://www.domain.com redirects to domain.com?domain=www.domain.com http://domain.com?domain=www.domain.com Anyway to fix that? www.domain.com http://www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.com wrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com http://domain.com So, abc.com http://abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
On 26/11/2012 4:17 PM, Steffan A. Cline stef...@hldns.com wrote: Is there a way to rewrite the HTTP_HOST where the . Is changed to a - ? HTTP_HOST= something.com Redirects to domain.com/something-com/ Is it possible? There is nothing to rewrite here. You need to do what you already said above, redirect the domain something to the other url. Thanks Steffan On 11/8/12 11:38 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.)?domain.com$ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 3:36 PM, Steffan A. Cline stef...@hldns.com wrote: Works a charm with one exception. www.domain.com redirects to domain.com?domain=www.domain.com Anyway to fix that? www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.com wrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com So, abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com So, abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan --- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline stef...@execuchoice.net Phoenix, Az http://www.ExecuChoice.net USA AIM: SteffanC Skype : steffancline GOOGLE : steffan.cl...@gmail.comMSN : stef...@hldns.com YAHOO : Steffan_Cline ICQ : 57234309 --- - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com http://domain.com So, abc.com http://abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
Works a charm with one exception. www.domain.com redirects to domain.com?domain=www.domain.com Anyway to fix that? www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.com wrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com http://domain.com So, abc.com http://abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
Cancel that Thanks Igor. Here is what I have and it works great!! RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com$1 [R=301,L] RewriteCond %{HTTP_HOST} !^namedeli.com$ [NC] RewriteRule .* http://domain.com/?domain=%{HTTP_HOST} [R,L] Thanks Steffan On 11/8/12 9:36 PM, Steffan A. Cline stef...@hldns.com wrote: Works a charm with one exception. www.domain.com redirects to domain.com?domain=www.domain.com Anyway to fix that? www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com http://domain.com $ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.com wrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.com wrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com http://domain.com So, abc.com http://abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.)?domain.com http://domain.com$ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 3:48 PM, Steffan A. Cline stef...@hldns.com wrote: Cancel that… Thanks Igor. Here is what I have and it works great!! RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com$1 [R=301,L] RewriteCond %{HTTP_HOST} !^namedeli.com$ [NC] RewriteRule .* http://domain.com/?domain=%{HTTP_HOST} [R,L] Thanks Steffan On 11/8/12 9:36 PM, Steffan A. Cline stef...@hldns.com wrote: Works a charm with one exception. www.domain.com redirects to domain.com?domain=www.domain.com Anyway to fix that? www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.comwrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.comwrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com So, abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite
RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.)?domain.com http://domain.com$ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 3:36 PM, Steffan A. Cline stef...@hldns.com wrote: Works a charm with one exception. www.domain.com redirects to domain.com?domain=www.domain.com Anyway to fix that? www.domain.com should be ignored since that is the domain itself. Thanks Steffan On 11/8/12 7:24 PM, Igor Cicimov icici...@gmail.com wrote: RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule .* http://domain.com?domain=%{HTTP_HOST} [R,L] On Fri, Nov 9, 2012 at 1:05 PM, Steffan A. Cline stef...@hldns.comwrote: Thanks for the URL. I did not read this one, but a similar one also on the site. I did not blindly ask for suggestions without trying it first. The issue I ran into was too many redirects. Clearly I didn't get it right and hoped someone may have something worth trying. Thanks Steffan On 11/8/12 6:32 PM, Igor Cicimov icici...@gmail.com wrote: On Fri, Nov 9, 2012 at 9:59 AM, Steffan A. Cline stef...@hldns.comwrote: I am trying to figure out a specific rewrite. I have a default host set up to catch any domains not served on the specific server. I am trying to direct unknown domains in a manner such as : default domain would be domain.com So, abc.com hits, it would be rewritten to http://domain.com?domain=abc.com or http://domain.com/abc-com/ Any suggestions? Yes, read the mod_rewrite page its all in there http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Thanks Steffan - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite question https to http
Hi Roland, on the context of SSL Virtual Host put the following rewrite rules: RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} iñigo On Wed, 1 Feb 2012, Roland RoLaNd wrote: Dear all, I'm a complete newbie to apache and i've inherited a virtual host setup.i have the need to redirect all traffic from https to http (443 to 80, yes that is correct) the relevant rewrite rules in httpd.conf are as such: # all other traffic is redirected to the SSL siteRewriteEngine On RewriteRule ^/cgi-bin/u/testing.cgi - [L]RewriteRule ^/cgi-bin/voice - [L] RewriteRule ^/cgi-bin/testing2.cgi - [L]RewriteRule ^/cgi-bin/u/results.pl - [L]RewriteRule ^/audio - [L] RewriteRule ^/gram - [L] RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [L,R=301] Any advice on how to force all https links to be redirected to http ? Thanks in advance - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org from the digest: users-digest-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
RE: [users@httpd] mod rewrite question https to http
Thank you for your help.is there any ebook you advise me to read to catch up on the below ? Date: Thu, 2 Feb 2012 07:04:06 -0200 From: imed...@grosshat.com To: users@httpd.apache.org Subject: Re: [users@httpd] mod rewrite question https to http Hi Roland, on the context of SSL Virtual Host put the following rewrite rules: RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} iñigo On Wed, 1 Feb 2012, Roland RoLaNd wrote: Dear all, I'm a complete newbie to apache and i've inherited a virtual host setup.i have the need to redirect all traffic from https to http (443 to 80, yes that is correct) the relevant rewrite rules in httpd.conf are as such: # all other traffic is redirected to the SSL siteRewriteEngine On RewriteRule ^/cgi-bin/u/testing.cgi - [L]RewriteRule ^/cgi-bin/voice - [L]RewriteRule ^/cgi-bin/testing2.cgi - [L]RewriteRule ^/cgi-bin/u/results.pl - [L]RewriteRule ^/audio - [L] RewriteRule ^/gram - [L] RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [L,R=301] Any advice on how to force all https links to be redirected to http ? Thanks in advance - The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org from the digest: users-digest-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] mod rewrite question https to http
Put the last rewrite rule inside your ssl virtual host and change https to http. On Feb 2, 2012 12:29 AM, Roland RoLaNd r_o_l_a_...@hotmail.com wrote: Dear all, I'm a complete newbie to apache and i've inherited a virtual host setup. i have the need to redirect all traffic from https to http (443 to 80, yes that is correct) the relevant rewrite rules in httpd.conf are as such: # all other traffic is redirected to the SSL site RewriteEngine On RewriteRule ^/cgi-bin/u/testing.cgi - [L] RewriteRule ^/cgi-bin/voice - [L] RewriteRule ^/cgi-bin/testing2.cgi - [L] RewriteRule ^/cgi-bin/u/results.pl - [L] RewriteRule ^/audio - [L] RewriteRule ^/gram - [L] RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [L,R=301] Any advice on how to force all https links to be redirected to http ? Thanks in advance
Re: [users@httpd] Mod-ReWrite
Hi, i am still having some problem with getting this to work. I am not getting the value that is in the query string to appear in the header. Any ideas on what I am doing wrong? I have the following url: http://localhost/test_rpc/header.jsp?tkn=abc In my httpd.conf I added the following: RewriteEngine on Options +FollowSymLinks RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn var1 In my test, the Header tkn shows up with a value of var1, instead of abc which is on the query string. Thanks in advance for your help suneet On Wed, Sep 21, 2011 at 1:20 AM, Igor Cicimov icici...@gmail.com wrote: Hi mate, Try something like this for the example you gave http://host/myapp?userid=abcrole=myrole: RewriteEngine on Options +FollowSymLinks http://host/myapp?userid=abcrole=myrole RewriteCond QUERY_STRING userid=(.*)role=(.*) RewriteRule ^/myapp$ [E=var1:%1,var2:%2] RequestHeader append userid var1 RequestHeader append role var2 This is untested and not sure about the correct syntax in the [E=var1:%1,var2:%2] flag, ie do you need coma or ; between the vars etc, but thats the general idea. Cheers, Igor On Wed, Sep 21, 2011 at 8:51 AM, Suneet Shah suneetshah2...@gmail.comwrote: Thanks Igor. Would you be able to point me to an example? I dont fully understand how I can configure this to take a parameter of the query string and then set a variable as a header. thanks for your help On Tue, Sep 20, 2011 at 6:29 PM, Igor Cicimov icici...@gmail.com wrote: Use mod_rewrite to set variable and then set that var as header. On Sep 21, 2011 7:32 AM, Suneet Shah suneetshah2...@gmail.com wrote: Hello, I had a question about Mod-Proxy and Mod_headers 1) Is it possible to take a values that are on a query string and pass them as headers? If so how? For example, if I have: http://host/myap?userid=abcrole=myrole I would like to take the values in the query string and pass them as headers to the app that I am proying to 2) I would like to pass the above headers or query string parameters on every request. How can I do this? Is there a way to put these values in session have have them passed as headers every time? If there is a better appraoch for the above, please let me know. thanks in advance for your help suneet
Re: [users@httpd] Mod-ReWrite
On September 24, 2011 16:06 , Suneet Shah suneetshah2...@gmail.com wrote: I have the following url: http://localhost/test_rpc/header.jsp?tkn=abc In my httpd.conf I added the following: RewriteEngine on Options +FollowSymLinks RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn var1 In my test, the Header tkn shows up with a value of var1, instead of abc which is on the query string. The RequestHeader directive you currently have means append the literal string 'var1' to the value of the header named 'tkn'; this is why you are seeing the above result in your test. The RequestHeader directive does not know that you want it to interpret 'var1' as the name of an environment variable, because you have not told it to do so. In order to append the value of the environment variable named 'var1' to the header named 'tkn', try RequestHeader append tkn %{var1}e For more information, see https://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader https://httpd.apache.org/docs/2.2/mod/mod_headers.html#header -- Mark Montague m...@catseye.org - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org from the digest: users-digest-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Mod-ReWrite
Hi, thanks very much for your help with this. I am a bit unclear in how information is assigned to variables and how they can be passed from one directive to another. I made the change that you described below. Now the tkn header is coming in as null. Have I made an error in assigning the tkn to var1? URL - http://localhost/test_rpc/header.jsp?tkn=abc Header value - tkn: (null) RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn %{var1}e Thanks for your help Suneet On Sat, Sep 24, 2011 at 4:25 PM, Mark Montague m...@catseye.org wrote: On September 24, 2011 16:06 , Suneet Shah suneetshah2...@gmail.com wrote: I have the following url: http://localhost/test_rpc/**header.jsp?tkn=abchttp://localhost/test_rpc/header.jsp?tkn=abc In my httpd.conf I added the following: RewriteEngine on Options +FollowSymLinks RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn var1 In my test, the Header tkn shows up with a value of var1, instead of abc which is on the query string. The RequestHeader directive you currently have means append the literal string 'var1' to the value of the header named 'tkn'; this is why you are seeing the above result in your test. The RequestHeader directive does not know that you want it to interpret 'var1' as the name of an environment variable, because you have not told it to do so. In order to append the value of the environment variable named 'var1' to the header named 'tkn', try RequestHeader append tkn %{var1}e For more information, see https://httpd.apache.org/docs/**2.2/mod/mod_headers.html#**requestheaderhttps://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader https://httpd.apache.org/docs/**2.2/mod/mod_headers.html#**headerhttps://httpd.apache.org/docs/2.2/mod/mod_headers.html#header -- Mark Montague m...@catseye.org
Re: [users@httpd] Mod-ReWrite
On September 24, 2011 22:23 , Suneet Shah suneetshah2...@gmail.com wrote: I made the change that you described below. Now the tkn header is coming in as null. Have I made an error in assigning the tkn to var1? URL - http://localhost/test_rpc/header.jsp?tkn=abc Header value - tkn: (null) RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn %{var1}e No, the problem is that the rewrite rule you have above tests for a path component that exactly matches /test_rpc/ with nothing before it and nothing after it. The URL you are testing with has a path component of /test_rpc/header.jsp -- so this does not match, the rewrite rule does not get invoked, and the 'var1' environment variable does not get set. To get a rewrite rule that tests for the correct thing, see https://httpd.apache.org/docs/2.2/rewrite/ in particular the Introduction to regular expressions and mod_rewrite section. Also, you appear to be missing the second argument of the rewrite rule. If you don't want to perform a substitution, then the substitution argument (the argument after the pattern argument and before the flags argument) needs to be a single dash (- without the quotes). -- Mark Montague m...@catseye.org - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org from the digest: users-digest-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Mod-ReWrite
Mark, Many thanks for your help. This now works Suneet On Sat, Sep 24, 2011 at 10:33 PM, Mark Montague m...@catseye.org wrote: On September 24, 2011 22:23 , Suneet Shah suneetshah2...@gmail.com wrote: I made the change that you described below. Now the tkn header is coming in as null. Have I made an error in assigning the tkn to var1? URL - http://localhost/test_rpc/**header.jsp?tkn=abchttp://localhost/test_rpc/header.jsp?tkn=abc Header value - tkn: (null) RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn %{var1}e No, the problem is that the rewrite rule you have above tests for a path component that exactly matches /test_rpc/ with nothing before it and nothing after it. The URL you are testing with has a path component of /test_rpc/header.jsp -- so this does not match, the rewrite rule does not get invoked, and the 'var1' environment variable does not get set. To get a rewrite rule that tests for the correct thing, see https://httpd.apache.org/docs/**2.2/rewrite/https://httpd.apache.org/docs/2.2/rewrite/in particular the Introduction to regular expressions and mod_rewrite section. Also, you appear to be missing the second argument of the rewrite rule. If you don't want to perform a substitution, then the substitution argument (the argument after the pattern argument and before the flags argument) needs to be a single dash (- without the quotes). -- Mark Montague m...@catseye.org
Re: [users@httpd] Mod-ReWrite
I tried to add another parameter to the query string and now the different parameters are getting merged together I am not sure if my error is in the RewriteCond or in the ReWriteRule. Any ideas? URL - http://localhost/test_rpc/header.jsp?tkn=xyzuserid=mylogin HEADERS PASSED: tkn: xyz;var2:mylogin userid: (null) RewriteCond %{QUERY_STRING} tkn=(.*)userid=(.*) RewriteRule ^/test_rpc - [E=var1:%1;var2:%2] RequestHeader append tkn %{var1}e RequestHeader append userid %{var2}e thanks for your help On Sat, Sep 24, 2011 at 10:44 PM, Suneet Shah suneetshah2...@gmail.comwrote: Mark, Many thanks for your help. This now works Suneet On Sat, Sep 24, 2011 at 10:33 PM, Mark Montague m...@catseye.org wrote: On September 24, 2011 22:23 , Suneet Shah suneetshah2...@gmail.com wrote: I made the change that you described below. Now the tkn header is coming in as null. Have I made an error in assigning the tkn to var1? URL - http://localhost/test_rpc/**header.jsp?tkn=abchttp://localhost/test_rpc/header.jsp?tkn=abc Header value - tkn: (null) RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn %{var1}e No, the problem is that the rewrite rule you have above tests for a path component that exactly matches /test_rpc/ with nothing before it and nothing after it. The URL you are testing with has a path component of /test_rpc/header.jsp -- so this does not match, the rewrite rule does not get invoked, and the 'var1' environment variable does not get set. To get a rewrite rule that tests for the correct thing, see https://httpd.apache.org/docs/**2.2/rewrite/https://httpd.apache.org/docs/2.2/rewrite/in particular the Introduction to regular expressions and mod_rewrite section. Also, you appear to be missing the second argument of the rewrite rule. If you don't want to perform a substitution, then the substitution argument (the argument after the pattern argument and before the flags argument) needs to be a single dash (- without the quotes). -- Mark Montague m...@catseye.org
Re: [users@httpd] Mod-ReWrite
Sorry, please disregard my question. I found my error. On Sat, Sep 24, 2011 at 11:04 PM, Suneet Shah suneetshah2...@gmail.comwrote: I tried to add another parameter to the query string and now the different parameters are getting merged together I am not sure if my error is in the RewriteCond or in the ReWriteRule. Any ideas? URL - http://localhost/test_rpc/header.jsp?tkn=xyzuserid=mylogin HEADERS PASSED: tkn: xyz;var2:mylogin userid: (null) RewriteCond %{QUERY_STRING} tkn=(.*)userid=(.*) RewriteRule ^/test_rpc - [E=var1:%1;var2:%2] RequestHeader append tkn %{var1}e RequestHeader append userid %{var2}e thanks for your help On Sat, Sep 24, 2011 at 10:44 PM, Suneet Shah suneetshah2...@gmail.comwrote: Mark, Many thanks for your help. This now works Suneet On Sat, Sep 24, 2011 at 10:33 PM, Mark Montague m...@catseye.org wrote: On September 24, 2011 22:23 , Suneet Shah suneetshah2...@gmail.com wrote: I made the change that you described below. Now the tkn header is coming in as null. Have I made an error in assigning the tkn to var1? URL - http://localhost/test_rpc/**header.jsp?tkn=abchttp://localhost/test_rpc/header.jsp?tkn=abc Header value - tkn: (null) RewriteCond %{QUERY_STRING} tkn=(.*) RewriteRule ^/test_rpc/$ [E=var1:%1] RequestHeader append tkn %{var1}e No, the problem is that the rewrite rule you have above tests for a path component that exactly matches /test_rpc/ with nothing before it and nothing after it. The URL you are testing with has a path component of /test_rpc/header.jsp -- so this does not match, the rewrite rule does not get invoked, and the 'var1' environment variable does not get set. To get a rewrite rule that tests for the correct thing, see https://httpd.apache.org/docs/**2.2/rewrite/https://httpd.apache.org/docs/2.2/rewrite/in particular the Introduction to regular expressions and mod_rewrite section. Also, you appear to be missing the second argument of the rewrite rule. If you don't want to perform a substitution, then the substitution argument (the argument after the pattern argument and before the flags argument) needs to be a single dash (- without the quotes). -- Mark Montague m...@catseye.org
Re: [users@httpd] Mod Rewrite for Server Status 503, depending upon URL
Thanks Pete. It worked perfectly!! :) On Sat, Sep 17, 2011 at 8:25 PM, Pete Houston p...@openstrike.co.uk wrote: Untested, but: VirtualHost x.x.x.x:80 ServerName www.mysite.com Location /books ErrorDocument 503 http://www.mypartnersite.com/books /Location Location /music ErrorDocument 503 http://www.mypartnersite.com/music /Location ... /VirtualHost should do what you describe. Pete On Sat, Sep 17, 2011 at 07:28:39PM +0530, Ujjwal Kumar wrote: /music is not a directory, it is just a URL which is routed to some specific JSP (bound with a struts action), through struts.xml and urlrewrite.xml (using tuckey). I am restating the problem with more clarity. Lets say we have 2 sites www.mysite.com and www.mypartnersite.com mysite deals with books, music, electronics, mobiles etc, partnersite deals with only books and music In case of system errors, say 503(site unavailable) I would like to automatically redirect www.mysite.com/books to www.mypartnersite.com/books www.mysite.com/music to www.mypartnersite.com/music and not do anything for www.mysite.com/electronics and www.mysite.com/mobiles [ ie give out 503 as it is] How to set this up? -- Openstrike - improving business through open source http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107
Re: [users@httpd] Mod Rewrite for Server Status 503, depending upon URL
/music is not a directory, it is just a URL which is routed to some specific JSP (bound with a struts action), through struts.xml and urlrewrite.xml (using tuckey). I am restating the problem with more clarity. Lets say we have 2 sites www.mysite.com and www.mypartnersite.com mysite deals with books, music, electronics, mobiles etc, partnersite deals with only books and music In case of system errors, say 503(site unavailable) I would like to automatically redirect www.mysite.com/books to www.mypartnersite.com/books www.mysite.com/music to www.mypartnersite.com/music and not do anything for www.mysite.com/electronics and www.mysite.com/mobiles [ ie give out 503 as it is] How to set this up? On Fri, Sep 16, 2011 at 9:36 PM, Mark Montague m...@catseye.org wrote: On September 16, 2011 2:58 , Ujjwal Kumar ujjwal.ku...@bankbazaar.com wrote: * /music is not a physical directory What is /music? Is this URL proxied? Is the content for this URL generated by a script? Something else? * In one sentence, the problem is to redirect specific urls (a) to a page only if that specific url (a) has a 503 error. The easiest way: 503 errors are not normal. Find what is causing the error and fix it. Alternatively, if the 503 error is being returned deliberately as a status by a script, modify the script so that the script does a 302 redirect instead (for example, to http://google.com/music) Another way: set up an ErrorDocument on your server (not on google.com) to handle all 503 errors. Have this ErrorDocument be a CGI script or other active content. The script should examine the REDIRECT_* environment variables set up by Apache HTTP Server to determine which URL the user was requesting, and, if the user was requesting /music, the script should generate a 302 response to redirect the user to http://google.com/music If the user was not requesting /music, then the script should do whatever you want done in the case of a 503 error (display an error message for the user, etc.). For details, see https://httpd.apache.org/docs/** 2.2/custom-error.htmlhttps://httpd.apache.org/docs/2.2/custom-error.html A harder way: Write an Apache HTTP Server module to do exactly what you want. An alternative to writing a module in C would be to use mod_perl: https://perl.apache.org/docs/**2.0/user/handlers/http.htmlhttps://perl.apache.org/docs/2.0/user/handlers/http.html I hope this helps. -- Mark Montague m...@catseye.org
Re: [users@httpd] Mod Rewrite for Server Status 503, depending upon URL
Untested, but: VirtualHost x.x.x.x:80 ServerName www.mysite.com Location /books ErrorDocument 503 http://www.mypartnersite.com/books /Location Location /music ErrorDocument 503 http://www.mypartnersite.com/music /Location ... /VirtualHost should do what you describe. Pete On Sat, Sep 17, 2011 at 07:28:39PM +0530, Ujjwal Kumar wrote: /music is not a directory, it is just a URL which is routed to some specific JSP (bound with a struts action), through struts.xml and urlrewrite.xml (using tuckey). I am restating the problem with more clarity. Lets say we have 2 sites www.mysite.com and www.mypartnersite.com mysite deals with books, music, electronics, mobiles etc, partnersite deals with only books and music In case of system errors, say 503(site unavailable) I would like to automatically redirect www.mysite.com/books to www.mypartnersite.com/books www.mysite.com/music to www.mypartnersite.com/music and not do anything for www.mysite.com/electronics and www.mysite.com/mobiles [ ie give out 503 as it is] How to set this up? -- Openstrike - improving business through open source http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107 pgp7JLfNRArs8.pgp Description: PGP signature
Re: [users@httpd] Mod Rewrite for Server Status 503, depending upon URL
On September 16, 2011 2:58 , Ujjwal Kumar ujjwal.ku...@bankbazaar.com wrote: * /music is not a physical directory What is /music? Is this URL proxied? Is the content for this URL generated by a script? Something else? * In one sentence, the problem is to redirect specific urls (a) to a page only if that specific url (a) has a 503 error. The easiest way: 503 errors are not normal. Find what is causing the error and fix it. Alternatively, if the 503 error is being returned deliberately as a status by a script, modify the script so that the script does a 302 redirect instead (for example, to http://google.com/music) Another way: set up an ErrorDocument on your server (not on google.com) to handle all 503 errors. Have this ErrorDocument be a CGI script or other active content. The script should examine the REDIRECT_* environment variables set up by Apache HTTP Server to determine which URL the user was requesting, and, if the user was requesting /music, the script should generate a 302 response to redirect the user to http://google.com/music If the user was not requesting /music, then the script should do whatever you want done in the case of a 503 error (display an error message for the user, etc.). For details, see https://httpd.apache.org/docs/2.2/custom-error.html A harder way: Write an Apache HTTP Server module to do exactly what you want. An alternative to writing a module in C would be to use mod_perl: https://perl.apache.org/docs/2.0/user/handlers/http.html I hope this helps. -- Mark Montague m...@catseye.org - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org from the digest: users-digest-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org