• Hello, I have some issue with multisite sub domain links. I have a main site: example.mysite.eu et second one example.mysite.eu/mytestsite. Navigation in my example.mysite.eu/mytestsite are some anchors (like some single page app). And I have additional page all projects: example.mysite.eu/mytestsite/allprojects. When I navigate in my home page everything work correctly. But when I try to navigate from example.mysite.eu/mytestsite/allprojects it redirects me to example.mysite.eu which is my main site.
    Actually I fixed this problem in js/main.js with ‘/’ + window.location.href.split(‘/’)[3] + ‘/’ adding to this line of code: window.location.href = window.location.origin + ‘/’ + window.location.href.split(‘/’)[3] + ‘/’ + target;
    But I think it is not a good practice. May be some one have an idea what is wrong. Thank you

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi

    Please try re-saving your permalinks(Settings->Permalinks->Save). I hope that it will fix your issue.

    Kind Regards

    Thread Starter vladyem

    (@vladyem)

    Hello @prashantvatsh, thank you for your advise! I will try it and tell you whether it worked or not

    Thread Starter vladyem

    (@vladyem)

    Hi @prashantvatsh I tried, unfortunately it does not work in my case. But thank you anyway for your time!

    But when I try to navigate from example.mysite.eu/mytestsite/allprojects it redirects me to example.mysite.eu which is my main site.

    Do you click on any link or logo image when you are getting redirected to your main site?

    Thread Starter vladyem

    (@vladyem)

    yes it is a links, here is a part of code of links (php file) and js which manages those links (it target .js-header-anchor) :

    header.php
    a href=”#front-project” class=”js-header-anchor
    a href=”#block-why” class=”js-header-anchor

    js/main.js
    $(‘.js-header-anchor’).on(‘click’, function(e){
    target = $(this).attr(‘href’);
    if ($(‘.page-template-template-donation-projet’).length ) {}
    else if( $(‘.home’).length ){
    pos = $(target).offset().top;
    $(‘html, body’).animate({scrollTop: pos}, 500);
    }else{
    window.location.href = window.location.origin + ‘/’ + window.location.href.split(‘/’)[3] + ‘/’ + target;
    }
    e.preventDefault();
    });

    • This reply was modified 5 years, 11 months ago by vladyem.
    • This reply was modified 5 years, 11 months ago by vladyem.
    Thread Starter vladyem

    (@vladyem)

    And I use wordpress multisite functionality:
    “SUBDOMAIN_INSTALL” => FALSE

    Instead of setting href=”#front-project” you can set as href=”your_subsite_url/#front-project” and then try with the following code:

    $(‘.js-header-anchor’).on(‘click’, function(e){
    var hash = this.hash;
    var target = $(this).attr(‘href’);
    if ($(‘.page-template-template-donation-projet’).length ) {}
    else if( $(‘.home’).length ){
    var pos = $(hash).offset().top;
    $(‘html, body’).animate({scrollTop: pos}, 500);
    window.location.hash = hash;
    }else{
    window.location.href = target;
    }
    e.preventDefault();
    });

    Kind Regards

    Thread Starter vladyem

    (@vladyem)

    Thank you very much @prashantvatsh!

    Hi, I am interested in having an easy way we can create subdomains for different themes. This will be potential people trying to build a test website with us and select the theme they want.

    Will this setup allow for a separate login, so the user can select one of the themes we have available for them.
    Second question, will they be able to customize the theme files locally or do they just pull from the global version in the network?

    _______
    https://www.friv9.xyz/

    • This reply was modified 5 years, 11 months ago by phuong2020.
Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Multisite sub domaine links’ is closed to new replies.