More details for redirect page


(Robin Shi) #1

Hi all,


I am try to get dynamic location from the redir page, like http://www.mysite.com/redir?pageid=12345

But I didn’t find sufficient info from http://www.mysite.com/redir?pageid=12345 in Session Variable section.

Is it possible to do?



Robin :rolleyes:


(Tbaatar) #2

The following should do what you are trying to achieve


This code wil print the current URL.


    
    http://%globals_server_SERVER_NAME%%globals_server_REQUEST_URI%


but if you want to print the referring url this will do the job.

    %globals_server_HTTP_REFERER%

(Robin Shi) #3

Thanks tbaatar, my bad not to have made it clear. I am trying to have redir page redir to a dynamic location depending on the get-URL-var. So http://www.mysite.com/redir?pageid=12345 goes to asset 12345, http://www.mysite.com/redir?pageid=12345 goes to asset 23456.
Is it possible?


(Dan Simmons) #4

This is pretty easy thanks to the relatively new "as_asset" keyword modifier:
http://manuals.matrix.squizsuite.net/concepts/chapters/keyword-modifiers



Simply:

[list=1]

  • Create a Redirect Page asset
    [*]In the URL field on the Details screen of the redirect page, enter: %globals_get_pageid^as_asset:asset_url%


    The result is that when you navigate to the redirect page on the frontend with "pageid=XXX" in the query string, it will redirect you to the URL of asset XXX.

  • (Robin Shi) #5

    Thanks Dan. I never know such input field in back end can use keywords other than static value. I will have a go thanks very much! :lol: Robin


    (Robin Shi) #6

    [quote]
    This is pretty easy thanks to the relatively new “as_asset” keyword modifier:

    http://manuals.matrix.squizsuite.net/concepts/chapters/keyword-modifiers



    Simply:

    [list=1]

  • Create a Redirect Page asset[*]In the URL field on the Details screen of the redirect page, enter: %globals_get_pageid^as_asset:asset_url%



    The result is that when you navigate to the redirect page on the frontend with “pageid=XXX” in the query string, it will redirect you to the URL of asset XXX.

    [/quote]

    Thanks again Dan, it works perfect!

  • (Dan Simmons) #7

    Glad to hear it! :smiley: