• Twice about root url#

  • tillda Reply #1, 5 years, 7 months ago

    Reply
    1. How do I specify, that for the root document I do not want any alias, just a www.domain.com.

    2. Is there some MODx tag/function, that would return the root url? For example, RFC says, that even in the simplest 301/302 redirection, it must be in the form of full valid URI, like 302 See Other : http://www.domain.com/some-modx-site, not just /some-modx-site, like is everywhere implemented. So when creating a snippet, I don't want to use just "302 See Other: [~id~]", I need the full URI with www. ... and directories, if presented.

    Thanks a lot.


  • ram Reply #2, 5 years, 7 months ago

    Reply
    I came into the same problem and it has also been mentioned in another thread
    @
    http://modxcms.com/forums/index.php/topic,5375.0.html

    I ended up creating a small plugin which that listens to 'OnWebPagePrerender' and removes the alias/id (I left the start page named the default of '1') from the links to the start page and set it to point at the web root '/'.

    $output = $modx->documentOutput;
    $pattern = '/href=\"1\/\"/';
    $replacement = 'href="/"';
    $modx->documentOutput = preg_replace($pattern, $replacement, $output);
    


  • chucktrukk Reply #3, 5 years, 7 months ago

    Reply
    That's a good tip ram.

    Thanks


  • tillda Reply #4, 5 years, 7 months ago

    Reply
    Quote from: ProWebscape at Jun 29, 2006, 01:52 PM
    That's a good tip ram.

    I'll probably take care of both in the SVN, becouse i need it NOW =)