Redirection after checking browser url

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirection after checking browser url

Eric DE MAULDE
Hi,

(I havn't had a response from the dev mailing list)

To avoid error or multiple urls for one page (SEO) or no content
I check the browser url with the original page url
If the bowser url is wrong, i want to redirect the visitor to the right
url
I don't want to use an HTML refresh.

If a call "response.sendRedirect('newUrl')" in groovy or ftl file
I have the error "IllegalStateException"

Do you have an idea ?
There is an other solution ?

Thanks

Eric
Reply | Threaded
Open this post in threaded view
|

Re: Redirection after checking browser url

Adrian Crum
That exception is thrown when the response has been committed. You can't
do a redirect after you start sending content.

-Adrian

On 6/7/2010 4:36 PM, eric wrote:

> Hi,
>
> (I havn't had a response from the dev mailing list)
>
> To avoid error or multiple urls for one page (SEO) or no content
> I check the browser url with the original page url
> If the bowser url is wrong, i want to redirect the visitor to the right
> url
> I don't want to use an HTML refresh.
>
> If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> I have the error "IllegalStateException"
>
> Do you have an idea ?
> There is an other solution ?
>
> Thanks
>
> Eric
>
Reply | Threaded
Open this post in threaded view
|

Re: Redirection after checking browser url

BJ Freeman
In reply to this post by Eric DE MAULDE
if you using AJP then I suggest rewrite in apache
http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
you can use regex

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


eric sent the following on 6/7/2010 4:36 PM:

> Hi,
>
> (I havn't had a response from the dev mailing list)
>
> To avoid error or multiple urls for one page (SEO) or no content
> I check the browser url with the original page url
> If the bowser url is wrong, i want to redirect the visitor to the right
> url
> I don't want to use an HTML refresh.
>
> If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> I have the error "IllegalStateException"
>
> Do you have an idea ?
> There is an other solution ?
>
> Thanks
>
> Eric
>

Reply | Threaded
Open this post in threaded view
|

Re: Redirection after checking browser url

Eric DE MAULDE
Thanks Adrian & BJ,

I use RewriteRule from Apache for basic rules
For a 2nd level, I want to check not the url structure but :
_ vocabulary words present into url (to redirect to the canonical url)
_ content page (no product ... to redirect to parent page with content)

For many thousands url, I can't use RewriteRule from Apache, it's too
complicated for me.
Now I use  <meta http-equiv="refresh"  content="0;canonicalUrl">
but this solution loads the content of a wrong url

So I need an intermediate solution beetween RewriteRule and HTML refresh
This solution has to be called from OFBiz

Eric


On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:

> if you using AJP then I suggest rewrite in apache
> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
> you can use regex
>
> =========================
> BJ Freeman
> http://bjfreeman.elance.com
> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
>
> Systems Integrator-- Glad to Assist
>
> Chat  Y! messenger: bjfr33man
> Linkedin
> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>
>
> eric sent the following on 6/7/2010 4:36 PM:
> > Hi,
> >
> > (I havn't had a response from the dev mailing list)
> >
> > To avoid error or multiple urls for one page (SEO) or no content
> > I check the browser url with the original page url
> > If the bowser url is wrong, i want to redirect the visitor to the right
> > url
> > I don't want to use an HTML refresh.
> >
> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> > I have the error "IllegalStateException"
> >
> > Do you have an idea ?
> > There is an other solution ?
> >
> > Thanks
> >
> > Eric
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: Redirection after checking browser url

Jacques Le Roux
Administrator
http://tuckey.org/urlrewrite/ ?

Jacques

From: "eric" <[hidden email]>

> Thanks Adrian & BJ,
>
> I use RewriteRule from Apache for basic rules
> For a 2nd level, I want to check not the url structure but :
> _ vocabulary words present into url (to redirect to the canonical url)
> _ content page (no product ... to redirect to parent page with content)
>
> For many thousands url, I can't use RewriteRule from Apache, it's too
> complicated for me.
> Now I use  <meta http-equiv="refresh"  content="0;canonicalUrl">
> but this solution loads the content of a wrong url
>
> So I need an intermediate solution beetween RewriteRule and HTML refresh
> This solution has to be called from OFBiz
>
> Eric
>
>
> On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:
>> if you using AJP then I suggest rewrite in apache
>> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
>> you can use regex
>>
>> =========================
>> BJ Freeman
>> http://bjfreeman.elance.com
>> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>> Specialtymarket.com  <http://www.specialtymarket.com/>
>>
>> Systems Integrator-- Glad to Assist
>>
>> Chat  Y! messenger: bjfr33man
>> Linkedin
>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>>
>>
>> eric sent the following on 6/7/2010 4:36 PM:
>> > Hi,
>> >
>> > (I havn't had a response from the dev mailing list)
>> >
>> > To avoid error or multiple urls for one page (SEO) or no content
>> > I check the browser url with the original page url
>> > If the bowser url is wrong, i want to redirect the visitor to the right
>> > url
>> > I don't want to use an HTML refresh.
>> >
>> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
>> > I have the error "IllegalStateException"
>> >
>> > Do you have an idea ?
>> > There is an other solution ?
>> >
>> > Thanks
>> >
>> > Eric
>> >
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Redirection after checking browser url

BJ Freeman
thank been looking it over

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Jacques Le Roux sent the following on 6/8/2010 2:44 AM:

> http://tuckey.org/urlrewrite/ ?
>
> Jacques
>
> From: "eric" <[hidden email]>
>> Thanks Adrian & BJ,
>>
>> I use RewriteRule from Apache for basic rules
>> For a 2nd level, I want to check not the url structure but :
>> _ vocabulary words present into url (to redirect to the canonical url)
>> _ content page (no product ... to redirect to parent page with content)
>>
>> For many thousands url, I can't use RewriteRule from Apache, it's too
>> complicated for me.
>> Now I use <meta http-equiv="refresh" content="0;canonicalUrl">
>> but this solution loads the content of a wrong url
>>
>> So I need an intermediate solution beetween RewriteRule and HTML refresh
>> This solution has to be called from OFBiz
>>
>> Eric
>>
>>
>> On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:
>>> if you using AJP then I suggest rewrite in apache
>>> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
>>> you can use regex
>>>
>>> =========================
>>> BJ Freeman
>>> http://bjfreeman.elance.com
>>> Strategic Power Office with Supplier Automation
>>> <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>>> Specialtymarket.com <http://www.specialtymarket.com/>
>>>
>>> Systems Integrator-- Glad to Assist
>>>
>>> Chat Y! messenger: bjfr33man
>>> Linkedin
>>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>>>
>>>
>>>
>>> eric sent the following on 6/7/2010 4:36 PM:
>>> > Hi,
>>> >
>>> > (I havn't had a response from the dev mailing list)
>>> >
>>> > To avoid error or multiple urls for one page (SEO) or no content
>>> > I check the browser url with the original page url
>>> > If the bowser url is wrong, i want to redirect the visitor to the
>>> right
>>> > url
>>> > I don't want to use an HTML refresh.
>>> >
>>> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
>>> > I have the error "IllegalStateException"
>>> >
>>> > Do you have an idea ?
>>> > There is an other solution ?
>>> >
>>> > Thanks
>>> >
>>> > Eric
>>> >
>>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Redirection after checking browser url

Eric DE MAULDE
In reply to this post by Jacques Le Roux
response.sendRedirect(newUrl)

it works fine, on condition to put this call into a groovy file before
all freemarker files

Eric

On Tue, 2010-06-08 at 11:44 +0200, Jacques Le Roux wrote:

> http://tuckey.org/urlrewrite/ ?
>
> Jacques
>
> From: "eric" <[hidden email]>
> > Thanks Adrian & BJ,
> >
> > I use RewriteRule from Apache for basic rules
> > For a 2nd level, I want to check not the url structure but :
> > _ vocabulary words present into url (to redirect to the canonical url)
> > _ content page (no product ... to redirect to parent page with content)
> >
> > For many thousands url, I can't use RewriteRule from Apache, it's too
> > complicated for me.
> > Now I use  <meta http-equiv="refresh"  content="0;canonicalUrl">
> > but this solution loads the content of a wrong url
> >
> > So I need an intermediate solution beetween RewriteRule and HTML refresh
> > This solution has to be called from OFBiz
> >
> > Eric
> >
> >
> > On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:
> >> if you using AJP then I suggest rewrite in apache
> >> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
> >> you can use regex
> >>
> >> =========================
> >> BJ Freeman
> >> http://bjfreeman.elance.com
> >> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> >> Specialtymarket.com  <http://www.specialtymarket.com/>
> >>
> >> Systems Integrator-- Glad to Assist
> >>
> >> Chat  Y! messenger: bjfr33man
> >> Linkedin
> >> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
> >>
> >>
> >> eric sent the following on 6/7/2010 4:36 PM:
> >> > Hi,
> >> >
> >> > (I havn't had a response from the dev mailing list)
> >> >
> >> > To avoid error or multiple urls for one page (SEO) or no content
> >> > I check the browser url with the original page url
> >> > If the bowser url is wrong, i want to redirect the visitor to the right
> >> > url
> >> > I don't want to use an HTML refresh.
> >> >
> >> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> >> > I have the error "IllegalStateException"
> >> >
> >> > Do you have an idea ?
> >> > There is an other solution ?
> >> >
> >> > Thanks
> >> >
> >> > Eric
> >> >
> >>
> >
>