ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Redirect to dynamic page

April 10, 2012 3:36am

Subscribe [1]
  • #1 / Apr 10, 2012 3:36am

    eddyfever

    62 posts

    I’m stuck with a problem for a while, and i was thinking maybe i can do this directly with EE.
    The problem is: I have a one layout page index.php, which loads content dynamic created with div’s. This means that i use a dynamic URL but with a static page and i wanna redirect the incoming links on a static page to the dynamic page.

    Examples URL’s
    Index page
    http://www.mydomain.com

    About us page:
    http://www.mydomain.com/#index.php/site/about

    Contact us page:
    http://www.mydomain.com/#index.php/site/contact

    etc… this works fine.

    But when you search on google the pages are separately founded by google, which is also great but the problem is google links them to:
    http://www.mydomain.com/index.php/site/about
    So without a #, which i need to navigate in the site.

    Now my first thought was that i can edit this with HTACCESS, but with no experience and knowledge this didn’t work for me.
    So other people say a “mod rewrite” but also with no knowledge this is a bit to hard for me.

    So thats why i now was looking for a EE solution like this one:

    {if site_url != '#index.php'} 
    <meta http-equiv="refresh" content="0;url={site_url}#index.php/{segment_1}/{segment_2}/{segment_3}" />
    {/if}

    This kindof do what i want, but i think i forgot something or do it the wrong way, because when i use this code in the header snippet, it will redirect from:

    http://www.mydomain.com/index.php/site/about/ to http://www.mydomain.com/#index.php/site/about/

    But then directly redirects to:
    http://www.mydomain.com/#index.php///
    and the page is gone.

    So after a long story, does anybody see what mistake i make or does somebody has experience with this problem who can help me with this.

    ————————————————————————————————
    Extra information:
    site_url = http://www.mydomain.com

    Thank you already for your time.

  • #2 / Apr 10, 2012 6:02pm

    Dan Decker

    7338 posts

    Hi eddyfever,

    This would not be a typical use of ExpressionEngine and would be outside our ability to offer support.

    You might be able to accomplish some of this with .htaccess and mod_rewrite, but they is beyond our realm.

    I’m going to move this into Community Help to see if any one there is able to offer some insight.

    Cheers!

  • #3 / Apr 18, 2012 3:51pm

    eddyfever

    62 posts

    Maybe not the nicest solution but it works, also with google.

    Create channel field, my case java (text)

    paste in a javascript which get’s the current URL.

    [removed]  [removed] (document.location.href);  [removed]/

    Template code on top of the page:

    {exp:channel:entries channel=CHANNELNAME" limit="1"}
          {if java =="{site_url}#index.php/{segment_1}/{segment_2}/{segment_3}"}
      {if:else}
          <meta http-equiv="refresh" content="0;URL={site_url}#index.php/{segment_1}/{segment_2}/{segment_3}" />
      {/if}
    {/exp:channel:entries}

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases