Coder Social home page Coder Social logo

Comments (8)

rabollin avatar rabollin commented on June 12, 2024

@ZubaeyrMSFT - seems to be some URL redirection configuration setup, look into this issue on priority.

from wordpress-linux-appservice.

ZubaeyrMSFT avatar ZubaeyrMSFT commented on June 12, 2024

@karpikpl

Please note that a Multisite WordPress can be associated and accessed with only one domain. You have used an AFD endpoint for installing the multisite (wordpressp-xxx.azurefd.net). And therefore, the WP is configured with it, and all the embedded links would point to it.

Few questions I wanted to understand. Are you looking for a subdomain-based multisite or subdirectory-based multisite? I see that you have installed subdirectory multisite and trying to access it like a subdomain one?

Please follow the instructions here: How to enable multisite WordPress on App Service and also refer to the Important Notes section in there.

These are the steps for converting a new single site to multisite (assuming AFD is already integrated with App Service and necessary app settings are added as mentioned here)

  1. Map all the required custom domains to the AFD endpoint.
    customdomain.org, site1.customdomain.org, site2.customdomain.org etc.,

  2. Add the following App Settings to install subdomain based multisite. This will only work if multisite isn't installed already.
    CUSTOM_DOMAIN - customdomain.org
    WORDPRESS_MULTISITE_TYPE - subdomain
    WORDPRESS_MULTISITE_CONVERT - true

  3. Add the following App Setting to install subdirectory based multisite. This will only work if multisite isn't installed already.
    CUSTOM_DOMAIN - customdomain.org
    WORDPRESS_MULTISITE_TYPE - subdirectory
    WORDPRESS_MULTISITE_CONVERT - true

from wordpress-linux-appservice.

ZubaeyrMSFT avatar ZubaeyrMSFT commented on June 12, 2024

If you want to update your current multisite to point to custom domain. You can try manual steps mentioned below.

  1. Map all the required custom domains to the AFD endpoint.
  2. Add CUSTOM_DOMAIN app setting to your App Service. (ex: customdomain.org)
  3. In order to change the domain associated with the multi-site post installation, you might have to manually update the occurrence of the old domain name in the MySQL database tables (i.e., replace occurrence of AFD endpoint with custom domain). Some common tables to look for are wp_options, wp_site, wp-blog, wp_users, wp_usermeta, wp_sitemeta and so on. Moreover, there can be specific sub-site tables (wp_2_site, wp_2_options etc.,). You can use /phpmyadmin to access your database.

from wordpress-linux-appservice.

karpikpl avatar karpikpl commented on June 12, 2024

I was trying to have a mix of multi-site and multi-domain.

I think that's what author of #84 did. Having wordpress configured with multi-site directory but AFD configured with multiple domains, e.g:

myfirstdomain.com -> wordpressp-xxx.azurefd.net/site1
myseconddomain.com -> wordpressp-xxx.azurefd.net/site2

but from what you're saying that's not possible - one wordpress instance == one domain?
Only sub-domains can be used?

from wordpress-linux-appservice.

ZubaeyrMSFT avatar ZubaeyrMSFT commented on June 12, 2024

Yes, you are right. Multisite supports only one main domain at a time. May I know if there are any reasons for using the mixed approach? And why not just use subdomain based multisite? It's better go with purely subdomain-based multisite in this case.

from wordpress-linux-appservice.

karpikpl avatar karpikpl commented on June 12, 2024

Thanks for all the answers and support!
I was trying to follow this - https://www.wpbeginner.com/wp-tutorials/how-to-create-a-wordpress-multisite-with-different-domains/ where different domains were possible.

I thought with AFD I can hide paths or set headers to make it work...

from wordpress-linux-appservice.

karpikpl avatar karpikpl commented on June 12, 2024

I went with subdomain route.
I verified with /phpmyadmin that all values are correct.
I checked that FD is setting custom host header on the route -> the subdomain one site3.wp.xxx.org. It was also added to app service as custom domain.

It doesn't work for me though - I cannot view the site (it shows the main one on wp.xxx.org) and I was getting CORS errors, so I've added subdomains to my App Service settings.

Still getting errors though:

Uncaught DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL 'https://wp.xxx.org/wp-admin/post-new.php' cannot be created in a document with origin 'https://site3.wp.xxx.org' and URL 'https://site3.wp.xxx.org/wp-admin/post-new.php'.

from wordpress-linux-appservice.

karpikpl avatar karpikpl commented on June 12, 2024

the subdomain part worked after adding this to wp-config.php

/** overriding HTTP_HOST header */
if (!empty(getenv('AFD_DOMAIN'))) {
        $_SERVER['HTTP_HOST'] = getenv('AFD_DOMAIN');
}

if (array_key_exists('HTTP_X_FORWARDED_HOST', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])){
        $_SERVER['HTTP_HOST']=$_SERVER['HTTP_X_FORWARDED_HOST'];
}

from wordpress-linux-appservice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.