How do rewrite rules work with multisite? (7 posts)

  1. maerk
    Posted 6 years ago #

    How does wordpress know which site it is on, given the URL.

    So, I remember from earlier versions, you could rewrite the url
    index.php/34 to index.php?p=34

    Is there an equivalent for each site?


    Is this the case?

  2. No, it's this:

    example.com/site1/post-1 == example.com/site1/index.php?p=34
    example.com/site2/post-1 == example.com/site2/index.php?p=34

    There is no in-between bit where it would translate the site number. How does it do that? Something VERY smart on the back end I gather.

  3. Via the rewrite rules, it looks up the request in the database & serves it directly.

  4. maerk
    Posted 6 years ago #

    So how does it serve the admin areas for the cities? It looks like it rewrites it back to the default admin location /wp-admin/whatever. How does the admin area know which city is being requested?

  5. How does the admin area know which city is being requested?

    It looks it up in the db based in the request coming in. That's why the full URL is stored in there.

    Is this a theoretical question, or are you trying to do something specific?

  6. Ron Rennick
    MultiSite Guru
    Posted 6 years ago #

    It doesn't do /wp-admin/whatever, it does /whatever/wp-admin.

  7. maerk
    Posted 6 years ago #

    Andrea_r: it was a little of both. I was trying to get rewrites working on an IIS server with ISAPI_rewrite by Helicon. Wanted to know if I had to hack the WordPress core to get it working, but it turns out I just needed to change the RewriteRules because the syntax is a little different.

    Thanks for your help though!

Topic Closed

This topic has been closed to new replies.

About this Topic