We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11975
    • 2,542 Posts
    Hi,

    you have to enable the friendly urls and friendly alias path

    Note that you ’ll have to add a <base href="[(site_url)]" /> tag in the <head> of your template.


    :-)
      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
      • 25663 MODX Staff
      • 12,272 Posts
      Can someone suggest a post title that makes sense so it is helpful for others. Thanks! laugh
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 26113
        • 88 Posts
        My original post was based on looking up content in a custom table.
        I have content outside of modx I’d like to integrate into modx.
        So I’d like to be able to create dynamic pages through modx without having to create every page within modx.

        I have friendly URL’s turned on and all is well for all other pages - but there is situation where I have content outside I’d like to integrate.

        Right now, my URL looks like
        http://ghoulghoul.com/detail?id=768&movie=688

        But I’d like them to be friendly URLs and still work within modx.

        Thanks
        Rich
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          How about using weblinks?
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 30223
            • 1,010 Posts
            Let’s see if we can get this clear. You have a database outside the modx db which contains the content for your movie pages (and perhaps the pagetitle etcetera). You can show all these pages via one modx document by using a snippet which fetches the data form the approriate table(s). If you haven’t done this yet there’ some info in the wiki on how to access another database from MODx

            The frienldly url scheme you originally intended can be achieved by an extra rewrite rule. Your .htaccess should look something like this:

            RewriteEngine on
            
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            #some rewrite magic to split filter and movie 
            RewriteRule ^movies/([a-z]{0,1})[/]*([0-9]*)$ movies.html?filter=$1&movie=$2 [QSA,PT]
            #followed by usual modx furl rule
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
            


            Here’s what will happen for different urls:

            http://your.domain.com/movies.html

            $_REQUEST = array (
              'q' => 'movies.html',
            )


            http://your.domain.com/movies/c
            $_REQUEST = array (
              'q' => 'movies.html',
              'filter' => 'c',
              'movie' => '',
            )

            http://your.domain.com/movies/23
            $_REQUEST = array (
              'q' => 'movies.html',
              'filter' => '',
              'movie' => '23',
            )

            http://your.domain.com/movies/f/23
            $_REQUEST = array (
              'q' => 'movies.html',
              'filter' => 'f',
              'movie' => '23',
            )


            Now all you have to do is (re)write your snippet to use the $_REQUEST[’filter’] and $_REQUEST[’movie’] variables and off you go....

            There are some drawbacks.. You can’t rely on MODx methods (or it’s various existing snippets) to generate these particular friendly urls for instance. You’ll have to code that yourself.