You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike Schleif <md...@helices.org> on 2008/06/17 07:11:14 UTC
[users@httpd] redirect to url w/query_string ???
I want the URL's similar to the following:
http://domain.tld
http://www.domain.tld
http://domain.tld/
http://domain.tld/fjlxasdfja
to be redirected to the following URL:
http://Other_domain.tld/?rid=48830
I have tried -- and failed -- with following:
RedirectMatch ^/$ http://Other_domain.tld/?rid=48830
RewriteCond %{QUERY_STRING} ^(rid=48830)$
RewriteRule ^/$ http://www.Other_domain.tld/$1?
NOTE[1]: There is NO query_string in original URL.
NOTE[2]: I have NOT found a way to escape the "?" in the destination
URL.
NOTE[3]: The result is always either "?" replaced with "%" escapes; or,
NO query_string at all.
What am I missing?
--
Best Regards,
Mike Schleif
mds resource
877.596.8237
Re: [users@httpd] redirect to url w/query_string ???
Posted by Mike Schleif <md...@helices.org>.
Please, advise.
Any ideas how to do this server-side redirect?
* On 2008:06:17:00:11:14-0500 I, Mike Schleif <md...@helices.org>, scribed:
> I want the URL's similar to the following:
>
> http://domain.tld
> http://www.domain.tld
> http://domain.tld/
> http://domain.tld/fjlxasdfja
>
> to be redirected to the following URL:
>
> http://Other_domain.tld/?rid=48830
>
>
> I have tried -- and failed -- with following:
>
> RedirectMatch ^/$ http://Other_domain.tld/?rid=48830
>
> RewriteCond %{QUERY_STRING} ^(rid=48830)$
> RewriteRule ^/$ http://www.Other_domain.tld/$1?
>
>
> NOTE[1]: There is NO query_string in original URL.
>
> NOTE[2]: I have NOT found a way to escape the "?" in the destination
> URL.
>
> NOTE[3]: The result is always either "?" replaced with "%" escapes; or,
> NO query_string at all.
>
>
> What am I missing?
--
Best Regards,
Mike Schleif
mds resource
877.596.8237
-
what will you do with 1 Million website visitors?
<http://millionsoffreevisitors.com>
--
Re: [users@httpd] redirect to url w/query_string ???
Posted by Mike Schleif <md...@helices.org>.
* Joshua Slive <jo...@slive.ca> [2008:06:20:13:17:15-0400] scribed:
> On Fri, Jun 20, 2008 at 12:51 PM, Mike Schleif <md...@helices.org> wrote:
>
> >
> > It creates rewrite.log; but, does not write anything there.
>
> That means your RewriteRules are not being seen at all in the request
> processing. Exactly where in your config files are you putting them?
>
> Joshua.
Very, very strange ?!?!
I replaced the RewriteRule discussed with this:
RedirectMatch ^/$ http://www.Other_domain.tld/?rid=48830
Of course, that redirected to Other_domain.tld; but, failed by
%-escaping the "?".
Then, I replaced that with the list suggested:
RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
NOW, that works ?!?!
However, still NO logging.
RewriteLog "/var/log/apache/rewrite.log"
RewriteLogLevel 9
These directives all reside within the subject <VirtualHost *> section.
What am I missing?
--
Best Regards,
Mike Schleif
mds resource
877.596.8237
-
What will you do with 1 Million website visitors?
<http://millionsoffreevisitors.com>
--
Re: [users@httpd] redirect to url w/query_string ???
Posted by Joshua Slive <jo...@slive.ca>.
On Fri, Jun 20, 2008 at 12:51 PM, Mike Schleif <md...@helices.org> wrote:
>
> It creates rewrite.log; but, does not write anything there.
That means your RewriteRules are not being seen at all in the request
processing. Exactly where in your config files are you putting them?
Joshua.
---------------------------------------------------------------------
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-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] redirect to url w/query_string ???
Posted by Mike Schleif <md...@helices.org>.
* Tom Donovan <do...@bellatlantic.net> [2008:06:20:12:19:11-0400] scribed:
> Mike Schleif wrote:
> >* Tom Donovan <do...@bellatlantic.net> [2008:06:20:09:08:55-0400]
> >scribed:
> >>Mike Schleif wrote:
> >>>I want the URL's similar to the following:
> >>>
> >>> http://domain.tld
> >>> http://www.domain.tld
> >>> http://domain.tld/
> >>> http://domain.tld/fjlxasdfja
> >>>
> >>>to be redirected to the following URL:
> >>>
> >>> http://Other_domain.tld/?rid=48830
> ...
> >>>What am I missing?
> >>>
> >>It's not clear what you are trying to do.
> >>
> >> Other_domain.tld vs. www.Other_domain.tld
> >> / vs. all URIs
> >>
> >>If you want everything re-directed to http://www.Other_domain.tld, try
> >>using just this single rewrite rule with the [noescape] flag:
> >>
> >> RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
> >>
> >>-tom-
> >
> >Yes, that is what I want to do.
> >
> >However, neither of the following work:
> >
> > RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
> > RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [R=301,NE]
> >
> >Does RewriteRule require RewriteCond, or anything else?
> >
> >Should RewriteRule work all by itself?
> >
> >Is there some way to test WHY this does not work?
> >
> >What am I missing?
> >
> >
> re: "Does RewriteRule require RewriteCond, or anything else?"
> No, presuming www.Other_domain.tld is on another machine - or at least in a
> different virtual host so it won't hit the same RewriteRule again after
> being redirected once.
>
> re: "Should RewriteRule work all by itself?"
> Yes.
>
> re: "Is there some way to test WHY this does not work?"
> Yes, add this:
> RewriteLog logs/rewrite.log
> RewriteLogLevel 9
> then look in logs/rewrite.log for the details of what mod_rewrite is doing.
>
> Works OK for me with Apache 2.2.8 on Windows. What are you running?
>
> -tom-
Apache/1.3.34 Server at localhost Port 80
It creates rewrite.log; but, does not write anything there.
The only write is to access.log:
"GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0" "-"
What am I missing?
--
Best Regards,
Mike Schleif
mds resource
877.596.8237
-
What will you do with 1 Million website visitors?
<http://millionsoffreevisitors.com>
--
Re: [users@httpd] redirect to url w/query_string ???
Posted by Tom Donovan <do...@bellatlantic.net>.
Mike Schleif wrote:
> * Tom Donovan <do...@bellatlantic.net> [2008:06:20:09:08:55-0400] scribed:
>> Mike Schleif wrote:
>>> I want the URL's similar to the following:
>>>
>>> http://domain.tld
>>> http://www.domain.tld
>>> http://domain.tld/
>>> http://domain.tld/fjlxasdfja
>>>
>>> to be redirected to the following URL:
>>>
>>> http://Other_domain.tld/?rid=48830
...
>>> What am I missing?
>>>
>> It's not clear what you are trying to do.
>>
>> Other_domain.tld vs. www.Other_domain.tld
>> / vs. all URIs
>>
>> If you want everything re-directed to http://www.Other_domain.tld, try
>> using just this single rewrite rule with the [noescape] flag:
>>
>> RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
>>
>> -tom-
>
> Yes, that is what I want to do.
>
> However, neither of the following work:
>
> RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
> RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [R=301,NE]
>
> Does RewriteRule require RewriteCond, or anything else?
>
> Should RewriteRule work all by itself?
>
> Is there some way to test WHY this does not work?
>
> What am I missing?
>
>
re: "Does RewriteRule require RewriteCond, or anything else?"
No, presuming www.Other_domain.tld is on another machine - or at least in a different virtual host
so it won't hit the same RewriteRule again after being redirected once.
re: "Should RewriteRule work all by itself?"
Yes.
re: "Is there some way to test WHY this does not work?"
Yes, add this:
RewriteLog logs/rewrite.log
RewriteLogLevel 9
then look in logs/rewrite.log for the details of what mod_rewrite is doing.
Works OK for me with Apache 2.2.8 on Windows. What are you running?
-tom-
---------------------------------------------------------------------
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-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] redirect to url w/query_string ???
Posted by Mike Schleif <md...@helices.org>.
* Tom Donovan <do...@bellatlantic.net> [2008:06:20:09:08:55-0400] scribed:
> Mike Schleif wrote:
> >I want the URL's similar to the following:
> >
> > http://domain.tld
> > http://www.domain.tld
> > http://domain.tld/
> > http://domain.tld/fjlxasdfja
> >
> >to be redirected to the following URL:
> >
> > http://Other_domain.tld/?rid=48830
> >
> >
> >I have tried -- and failed -- with following:
> >
> > RedirectMatch ^/$ http://Other_domain.tld/?rid=48830
> >
> > RewriteCond %{QUERY_STRING} ^(rid=48830)$
> > RewriteRule ^/$ http://www.Other_domain.tld/$1?
> >
> >
> >NOTE[1]: There is NO query_string in original URL.
> >
> >NOTE[2]: I have NOT found a way to escape the "?" in the destination
> >URL.
> >
> >NOTE[3]: The result is always either "?" replaced with "%" escapes; or,
> >NO query_string at all.
> >
> >
> >What am I missing?
> >
>
> It's not clear what you are trying to do.
>
> Other_domain.tld vs. www.Other_domain.tld
> / vs. all URIs
>
> If you want everything re-directed to http://www.Other_domain.tld, try
> using just this single rewrite rule with the [noescape] flag:
>
> RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
>
> -tom-
Yes, that is what I want to do.
However, neither of the following work:
RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [R=301,NE]
Does RewriteRule require RewriteCond, or anything else?
Should RewriteRule work all by itself?
Is there some way to test WHY this does not work?
What am I missing?
--
Best Regards,
Mike Schleif
mds resource
877.596.8237
-
What will you do with 1 Million website visitors?
<http://millionsoffreevisitors.com>
--
Re: [users@httpd] redirect to url w/query_string ???
Posted by Tom Donovan <do...@bellatlantic.net>.
Mike Schleif wrote:
> I want the URL's similar to the following:
>
> http://domain.tld
> http://www.domain.tld
> http://domain.tld/
> http://domain.tld/fjlxasdfja
>
> to be redirected to the following URL:
>
> http://Other_domain.tld/?rid=48830
>
>
> I have tried -- and failed -- with following:
>
> RedirectMatch ^/$ http://Other_domain.tld/?rid=48830
>
> RewriteCond %{QUERY_STRING} ^(rid=48830)$
> RewriteRule ^/$ http://www.Other_domain.tld/$1?
>
>
> NOTE[1]: There is NO query_string in original URL.
>
> NOTE[2]: I have NOT found a way to escape the "?" in the destination
> URL.
>
> NOTE[3]: The result is always either "?" replaced with "%" escapes; or,
> NO query_string at all.
>
>
> What am I missing?
>
It's not clear what you are trying to do.
Other_domain.tld vs. www.Other_domain.tld
/ vs. all URIs
If you want everything re-directed to http://www.Other_domain.tld, try using just this single
rewrite rule with the [noescape] flag:
RewriteRule ^/.*$ http://www.Other_domain.tld/?rid=48830 [noescape]
-tom-
---------------------------------------------------------------------
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-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org