We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53611
    • 4 Posts
    Hello!

    I'm trying to make the following scenario in Modx Revo - by clicking on the link www.mysite.com/adrs/aaa/bbb to go to www.mysite.com/test.php?c=adrs&street=aaa&house=bbb, where street is the name of the street, house is the house number. And for the user the final page of the transition should be hidden and remain as viewable the original one in the form of www.mysite.com/adrs/aaa/bbb
    The resulting page contains a snippet that outputs certain information for the given address, for example, all the transmitted parameters by means of "print_r ($_GET);".

    Now the added part of the .htaccess file looks like this:
    RewriteCond% {REQUEST_FILENAME}! -f
    RewriteCond% {REQUEST_FILENAME}! -d
    RewriteRule ^adrs /(.*)/(.*)/?$ test.php?c=adrs&street=$1&house=$2 [L]
    
    #The Friendly URLs part
    RewriteCond% {REQUEST_FILENAME}! -f
    RewriteCond% {REQUEST_FILENAME}! -d
    RewriteRule ^(.*)$ Index.php?q=$1 [L, QSA]
    


    The script works, but it shoes www.mysite.com/test.php?c=adrs&street=aaa&house=bbb

    Please, advise how to improve this scenario, especially to edit RewriteRule in .htaccess.

    P.S. Perhaps my task is easier to implement in some other way, for example, by creating an ‘adrs’ component, using namespaces, by creating plugin with some event or by registering something in connectors, core, or something else?
      • 52064
      • 120 Posts
        FerX - Developer at Eracom s.r.l.
        • 53611
        • 4 Posts
        Quote from: ferx77 at Jul 19, 2017, 08:17 AM
        Try https://docs.modx.com/extras/revo/customurls

        I would highly appreciate an example for CustomURL for my case especially for the 'pattern' field. I do not understand how to pass the 'street' and the 'house' there.
          • 52064
          • 120 Posts
          Opsss... My error..
          This is the correct extra
          https://modx.com/extras/package/customrequest
            FerX - Developer at Eracom s.r.l.