Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ardalanme

    (@ardalanme)

    I don’t think it is related to incorrect redirect rules. I’m able to use regex, but it doesn’t solve my problem.

    I’m developing a new e-commerce site for an old company. The URLs in the old site were like:

    /si/ui_public/catalog/category1.aspx
    /si/ui_public/catalog/category2.aspx
    ...

    There is a new URL structure on the new WP-based site, and some categories do not exist on the new site anymore. Let’s say category2 doesn’t exist on the new site, but category1 does.

    So I want to redirect
    /si/ui_public/catalog/category1.aspx
    to
    /catalog/category1/
    (There are ~40 redirects like this)

    And I want to redirect any URL that’s not covered by the redirects defined before, to the main catalog page (/catalog/). But it’s not currently easy to do so using this plugin.

    I could use regex and do something like: \/si\/ui_public\/catalog\/(?!(category2|category5|...))[^\/]*\.aspx
    But then I’d have to list more than 40 categories in a relatively complex regex.

    The ability to add an order number to redirects could easily solve all this.

    Hey everyone,
    I came up with a quick fix. Feel free to implement it until the plugin author publishes an update.

    In plugins/wp3-total-cache/lib/W3/Plugin/Cdn.php line 1008 change the following code:

    if (preg_match('~' . $domain_url_regexp . '~i', $baseurl)) {
                $regexps[] = '~(["\'(])\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($upload_info['baseurlpath']) . '([^"\')>]+)))~';
            } else {
                $parsed = @parse_url($baseurl);

    To:

    if (preg_match('~' . $domain_url_regexp . '~i', $baseurl)) {
                $regexps[] = '~(["\'(])\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($upload_info['baseurlpath']) . '([^"\')>]+)))~';
    
                // This will correct up to 10 media urls within a html attribute (srcset for example)
                for ( $i = 0; $i < 10; $i++ )
                    $regexps[] = '~([(, )"\'(])\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($upload_info['baseurlpath']) . '([^"\')>]+)))~';
    
            } else {
                $parsed = @parse_url($baseurl);

    Thread Starter ardalanme

    (@ardalanme)

    Another similar notice:


    Notice: Undefined variable: crosssells_p_array in /wp-content/plugins/woocommerce-cross-sell-products-display/woocommerce-cross-sell-products-display.php on line 60

    Fixed by changing the line to:

    if( isset( $crosssells_p_array ) AND is_array($crosssells_p_array) && !empty($crosssells_p_array)){

Viewing 3 replies - 1 through 3 (of 3 total)