301 redirect

View: New views
6 Messages — Rating Filter:   Alert me  

301 redirect

by Douglas Ferguson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I recently had a requirement that involved setting up several urls
that point to the same page.

After implementing it got kicked back to me because I just set up
bookmarkable page bindings my applicaiton class.
Well turns out they really wan't them to be 301 redirects so that
there google sees them as cannonical pages, weird SEO stuff.

Anybody have any ideas for a way to do this in wicket?

I'm assuming I"ll have to make individual pages and use meta tag?

D/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 301 redirect

by igor.vaynberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hm, how about something roughly like:


mount(new abstractrequesttargeturlcodingstrategy("pages/page4") {
      decode() {
        return new irequesttarget() {
             respond(requestcycle rc) {
               rc.getresponse().setheader(301, urlfor(Page1.class)); }}}});

-igor

On Wed, Nov 4, 2009 at 9:27 PM, Douglas Ferguson
<douglas@...> wrote:

> I recently had a requirement that involved setting up several urls
> that point to the same page.
>
> After implementing it got kicked back to me because I just set up
> bookmarkable page bindings my applicaiton class.
> Well turns out they really wan't them to be 301 redirects so that
> there google sees them as cannonical pages, weird SEO stuff.
>
> Anybody have any ideas for a way to do this in wicket?
>
> I'm assuming I"ll have to make individual pages and use meta tag?
>
> D/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 301 redirect

by Douglas Ferguson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

wow.. cool that would do it.

thanks!

On Nov 4, 2009, at 11:35 PM, Igor Vaynberg wrote:

> hm, how about something roughly like:
>
>
> mount(new abstractrequesttargeturlcodingstrategy("pages/page4") {
>      decode() {
>        return new irequesttarget() {
>             respond(requestcycle rc) {
>               rc.getresponse().setheader(301, urlfor
> (Page1.class)); }}}});
>
> -igor
>
> On Wed, Nov 4, 2009 at 9:27 PM, Douglas Ferguson
> <douglas@...> wrote:
>> I recently had a requirement that involved setting up several urls
>> that point to the same page.
>>
>> After implementing it got kicked back to me because I just set up
>> bookmarkable page bindings my applicaiton class.
>> Well turns out they really wan't them to be 301 redirects so that
>> there google sees them as cannonical pages, weird SEO stuff.
>>
>> Anybody have any ideas for a way to do this in wicket?
>>
>> I'm assuming I"ll have to make individual pages and use meta tag?
>>
>> D/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 301 redirect

by Douglas Ferguson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do I need to worry about any of the other methods on  
abstractrequesttargeturlcodingstrategy?


On Nov 4, 2009, at 11:35 PM, Igor Vaynberg wrote:

> hm, how about something roughly like:
>
>
> mount(new abstractrequesttargeturlcodingstrategy("pages/page4") {
>      decode() {
>        return new irequesttarget() {
>             respond(requestcycle rc) {
>               rc.getresponse().setheader(301, urlfor
> (Page1.class)); }}}});
>
> -igor
>
> On Wed, Nov 4, 2009 at 9:27 PM, Douglas Ferguson
> <douglas@...> wrote:
>> I recently had a requirement that involved setting up several urls
>> that point to the same page.
>>
>> After implementing it got kicked back to me because I just set up
>> bookmarkable page bindings my applicaiton class.
>> Well turns out they really wan't them to be 301 redirects so that
>> there google sees them as cannonical pages, weird SEO stuff.
>>
>> Anybody have any ideas for a way to do this in wicket?
>>
>> I'm assuming I"ll have to make individual pages and use meta tag?
>>
>> D/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 301 redirect

by Douglas Ferguson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This seems to work:

        private void mount301(final String path, final String destination) {
                mount(new AbstractRequestTargetUrlCodingStrategy(path) {

                        @Override
                        public IRequestTarget decode(RequestParameters requestParameters) {
                                return new IRequestTarget() {

                                        @Override
                                        public void detach(RequestCycle requestCycle) {
                                        }

                                        @Override
                                        public void respond(RequestCycle requestCycle) {

                                                ((BufferedWebResponse)requestCycle.getResponse
()).getHttpServletResponse().setStatus(301);
                                                ((BufferedWebResponse)requestCycle.getResponse()).setHeader
("Location", destination);

                                        }};
                        }

                        @Override
                        public CharSequence encode(IRequestTarget requestTarget) {
                                return null;
                        }

                        @Override
                        public boolean matches(IRequestTarget requestTarget) {
                                return false;
                        }});
        }

On Nov 4, 2009, at 11:52 PM, Douglas Ferguson wrote:

> Do I need to worry about any of the other methods on
> abstractrequesttargeturlcodingstrategy?
>
>
> On Nov 4, 2009, at 11:35 PM, Igor Vaynberg wrote:
>
>> hm, how about something roughly like:
>>
>>
>> mount(new abstractrequesttargeturlcodingstrategy("pages/page4") {
>>     decode() {
>>       return new irequesttarget() {
>>            respond(requestcycle rc) {
>>              rc.getresponse().setheader(301, urlfor
>> (Page1.class)); }}}});
>>
>> -igor
>>
>> On Wed, Nov 4, 2009 at 9:27 PM, Douglas Ferguson
>> <douglas@...> wrote:
>>> I recently had a requirement that involved setting up several urls
>>> that point to the same page.
>>>
>>> After implementing it got kicked back to me because I just set up
>>> bookmarkable page bindings my applicaiton class.
>>> Well turns out they really wan't them to be 301 redirects so that
>>> there google sees them as cannonical pages, weird SEO stuff.
>>>
>>> Anybody have any ideas for a way to do this in wicket?
>>>
>>> I'm assuming I"ll have to make individual pages and use meta tag?
>>>
>>> D/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 301 redirect

by igor.vaynberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

no, afair the others are only used when generating a url, which is not
part of your usecase.

-igor

On Wed, Nov 4, 2009 at 9:52 PM, Douglas Ferguson
<douglas@...> wrote:

> Do I need to worry about any of the other methods on
> abstractrequesttargeturlcodingstrategy?
>
>
> On Nov 4, 2009, at 11:35 PM, Igor Vaynberg wrote:
>
>> hm, how about something roughly like:
>>
>>
>> mount(new abstractrequesttargeturlcodingstrategy("pages/page4") {
>>      decode() {
>>        return new irequesttarget() {
>>             respond(requestcycle rc) {
>>               rc.getresponse().setheader(301, urlfor
>> (Page1.class)); }}}});
>>
>> -igor
>>
>> On Wed, Nov 4, 2009 at 9:27 PM, Douglas Ferguson
>> <douglas@...> wrote:
>>> I recently had a requirement that involved setting up several urls
>>> that point to the same page.
>>>
>>> After implementing it got kicked back to me because I just set up
>>> bookmarkable page bindings my applicaiton class.
>>> Well turns out they really wan't them to be 301 redirects so that
>>> there google sees them as cannonical pages, weird SEO stuff.
>>>
>>> Anybody have any ideas for a way to do this in wicket?
>>>
>>> I'm assuming I"ll have to make individual pages and use meta tag?
>>>
>>> D/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...