We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Description
    Use pretty URLs everywhere.

    Features
    With CustomRequest pretty virtual URLs could be mapped easy to a MODX resource and set the request parameter by separating the URI path at the URI separators or by a regular expression.

    The first characters of the not found URI will be compared with the alias value of each config entry. If found, this config entry is used. The alias is stripped from the not found URI and the remaining string is used to set the request parameters.

    Bugtracker and hotfixes on GitHub
      • 14214
      • 299 Posts
      Interesting...
        • 46315
        • 30 Posts
        Hi Jako

        I'd like to know if it is possible to create a "custom" friendly URL like:

        from: non furl(domain.com/index.php?id=18&Pref=R1234) - or with furl(domain.com/product.html?Pref=R1234)

        to: domain.com/product/a-must-have-product/R1234

        The product data is being pulled from a custom table through a resource(id 18) using Rowboat where ?Pref=R1234. I've installed the customrequest extra and setup a product.config.inc.php file containing:

        <?php
        $settings['product'] = array(
        'resourceId' => 18,
        'alias' => 'product/',
        	'urlParams' => array('Pref')
        );
        ?>


        ..but am getting a 404 not found page. Where am I going wrong?

        Let me know if you'd like any debug error log info.

        Thanks in advance.

        Setup:
        Revolution 2.2.14
        Use Friendly URLs = Yes
        • With your product.config.inc.php the url domain.com/product.html?Pref=R1234

          would translate to: domain.com/index.php?id=18&Pref=a-must-have-product&p2=R1234
            • 46315
            • 30 Posts
            Hi Jako, thanks for the response.

            With the above product.config.inc.php set up, if I enter "domain.com/product/R1234", which if I understand correctly, will only pass the one "urlParam"(Pref). I still get a 404 reponse.

            Apologies if I'm missing the obvious.
            • Is the plugin active? Are there any errors in the MODX system log?
                • 46315
                • 30 Posts
                The "CustomRequest" plugin is enabled and checked for "OnPageNotFound" system event.

                Here's the error log:
                (ERROR @ /home/sites/domain.com/public_html/core/components/customrequest/model/customrequest/customrequest.class.php : 162) PHP warning: Invalid argument supplied for foreach()

                Many thanks.
                • It seems that no config file is found or the config file produces an error.

                  Is 'products' a folder?
                    • 46315
                    • 30 Posts
                    "product" resource is a container at the root of the modx resources tree with an alias of "product". Is that what you meant?

                    The config file is "product.config.inc.php" and it is located in core/components/customrequest/configs/product.config.inc.php

                    This is the config file:
                    <?php
                    $settings['product'] = array(
                    'resourceId' => 18,
                    'alias' => 'product/',
                        'urlParams' => array('Pref')
                    );
                    ?>


                    System Settings:

                    customrequest.configsPath: {core_path}components/customrequest/
                    • Please update CustomRequest and set the customrequest.debug to 1 in system settings. Then you could see some entries in the system log telling you, what is going wrong. The error should not occur anymore.