-1

A few hours ago, I had a task to integrate the VCMS by Merlinx with Wordpress.

There are two main issues:
1) Wordpress tries to add slash as the last character in URL and any JS or another resource can't be loaded
2) Module needs a custom rewrite rules,which conflict with WordPress rules

On the internet, there is no info how to solve this issue.

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
Frost
  • 31
  • 5
  • If its not a question, why post it as a question? What you could have done instead (which would have been correct) would be to have posted the problem, and answered the question yourself with the solution. – Takarii Nov 11 '16 at 13:27
  • Yes, but as I think, it looked strange.In both cases. To solve the problem a lot of time has been spent because API documentation is bad – Frost Nov 11 '16 at 17:24

1 Answers1

0

So, if you will have trouble with same issue, this is the fast solution:


1) Code inside functions.php

add_action( 'init', function() {
    add_rewrite_rule( '__page_slug__/(.*)$', 'index.php?pagename=__page_slug__&_url=/$matches[1]', 'top' );
} );
add_filter( 'query_vars', 'prefix_query_vars' );
function prefix_query_vars( $query_vars )
{
    $query_vars[] = '_url';
    return $query_vars;
}

2) Insert inside rwdGate.php:

//before line with $rwdUrl = 'http://' . $this->domainName . '/' . $url[1];
    $url[1]= preg_replace("/(\?v=).*$/",'',$url[1]); // for fonts

    if(substr($url[1], -1) == '/') {
        $url[1] = substr($url[1], 0, -1); // for js
    }

This is a hack, if there is some solution based on .htaccess, I'll be glad to see him.

Frost
  • 31
  • 5